Browse Source

Adds stripped down boilerplate game files and templates

drone-waypoint
Logan Koester 3 years ago
parent
commit
76eec4ebf0
No known key found for this signature in database GPG Key ID: EBA7BD5CB8B7CB94
  1. 4
      .gitea/template
  2. 6
      .gitignore
  3. 23
      .smaugignore
  4. 2
      LICENSE
  5. 6
      README.md
  6. 22
      Smaug.toml
  7. 7
      app/main.rb
  8. 307
      app/repl.rb
  9. 29
      app/tests.rb
  10. 1
      data/.gitkeep
  11. 1
      fonts/.gitkeep
  12. 10
      metadata/game_metadata.txt
  13. BIN
      metadata/icon.png
  14. 14
      metadata/ios_metadata.txt
  15. 4
      smaug.rb
  16. 1
      sounds/.gitkeep
  17. BIN
      sprites/misc/dragon-0.png
  18. BIN
      sprites/misc/dragon-1.png
  19. BIN
      sprites/misc/dragon-2.png
  20. BIN
      sprites/misc/dragon-3.png
  21. BIN
      sprites/misc/dragon-4.png
  22. BIN
      sprites/misc/dragon-5.png
  23. BIN
      sprites/misc/explosion-0.png
  24. BIN
      sprites/misc/explosion-1.png
  25. BIN
      sprites/misc/explosion-2.png
  26. BIN
      sprites/misc/explosion-3.png
  27. BIN
      sprites/misc/explosion-4.png
  28. BIN
      sprites/misc/explosion-5.png
  29. BIN
      sprites/misc/explosion-6.png
  30. BIN
      sprites/misc/explosion-sheet.png

4
.gitea/template

@ -0,0 +1,4 @@
*.md
LICENSE
Smaug.toml
app/main.rb

6
.gitignore

@ -0,0 +1,6 @@
builds/
logs/
exceptions/
last_replay.txt
replay.txt
.DS_Store

23
.smaugignore

@ -0,0 +1,23 @@
.gitkeep
.gitlab-ci.yml
.rspec
.github/
.gitignore
.rubocop.yml
.travis.yml
.do/
.smaugignore
Rakefile
Gemfile
Gemfile.lock
*.gemspec
smaug/**/bin/
smaug/**/spec/
smaug/**/samples/
logs/
builds/
dist/
index.html
*.md
exceptions
.DS_Store

2
LICENSE

@ -1,6 +1,6 @@
MIT License
Copyright (c) <year> <copyright holders>
Copyright (c) 2022 ${REPO_OWNER}
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:

6
README.md

@ -1,3 +1,5 @@
# smaug_project_template
# ${REPO_NAME}
Template repo for a Smaug project
> ${REPO_DESCRIPTION}
---

22
Smaug.toml

@ -0,0 +1,22 @@
[project]
# The name of your game's executable. This should only contain a-z, A-Z, 0-9, _ or -.
name = "${REPO_NAME_SNAKE}"
# The game's title. This will show up in the tile bar of your executable.
title = "${REPO_NAME_TITLE}"
version = "0.1.0"
authors = ["TODO: ${REPO_OWNER} <todo@example.com>"]
icon = "metadata/icon.png"
compile_ruby = false
[dragonruby]
version = "3.0"
edition = "pro"
[dependencies]
[itch]
# The Project URL you set when you created the game on Itch.io. https://my-username.itch.io/my-game.
# This will also be the name of your build files, so fill it out even if you aren't uploading to Itch.io.
url = "todo-change-me"
# Your username on Itch.io.
username = "todo-change-me"

7
app/main.rb

@ -0,0 +1,7 @@
require 'smaug.rb'
def tick args
args.outputs.labels << [640, 500, '${REPO_NAME_TITLE}', 5, 1]
args.outputs.labels << [640, 460, '${REPO_DESCRIPTION}', 5, 1]
args.outputs.sprites << [576, 280, 128, 101, 'dragonruby.png']
end

307
app/repl.rb

@ -0,0 +1,307 @@
# ===============================================================
# Welcome to repl.rb
# ===============================================================
# You can experiement with code within this file. Code in this
# file is only executed when you save (and only excecuted ONCE).
# ===============================================================
# ===============================================================
# REMOVE the "x" from the word "xrepl" and save the file to RUN
# the code in between the do/end block delimiters.
# ===============================================================
# ===============================================================
# ADD the "x" to the word "repl" (make it xrepl) and save the
# file to IGNORE the code in between the do/end block delimiters.
# ===============================================================
# Remove the x from xrepl to run the code. Add the x back to ignore to code.
xrepl do
puts "The result of 1 + 2 is: #{1 + 2}"
end
# ====================================================================================
# Ruby Crash Course:
# Strings, Numeric, Booleans, Conditionals, Looping, Enumerables, Arrays
# ====================================================================================
# ====================================================================================
# Strings
# ====================================================================================
# Remove the x from xrepl to run the code. Add the x back to ignore to code.
xrepl do
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
# ====================================================================================
# Numerics
# ====================================================================================
# Remove the x from xrepl to run the code. Add the x back to ignore to code.
xrepl do
a = 10
puts "The value of a is: #{a}"
puts "a + 1 is: #{a + 1}"
puts "a / 3 is: #{a / 3}"
end
# Remove the x from xrepl to run the code. Add the x back to ignore to code.
xrepl do
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
# ====================================================================================
# Booleans
# ====================================================================================
# Remove the x from xrepl to run the code. Add the x back to ignore to code.
xrepl do
c = 30
puts "The value of c is #{c}."
if c
puts "This if statement ran because c is truthy."
end
end
# Remove the x from xrepl to run the code. Add the x back to ignore to code.
xrepl do
d = false
puts "The value of d is #{d}."
if !d
puts "This if statement ran because d is falsey, using the not operator (!) makes d evaluate to true."
end
e = nil
puts "Nil is also considered falsey. The value of e is: #{e}."
if !e
puts "This if statement ran because e is nil (a falsey value)."
end
end
# ====================================================================================
# Conditionals
# ====================================================================================
# Remove the x from xrepl to run the code. Add the x back to ignore to code.
xrepl do
i_am_true = true
i_am_nil = nil
i_am_false = false
i_am_hi = "hi"
puts "======== if statement"
i_am_one = 1
if i_am_one
puts "This was printed because i_am_one is truthy."
end
puts "======== if/else statement"
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
puts "======== if/elsif/else statement"
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
puts "======== case statement "
i_am_one = 1
case i_am_one
when 10
puts "case equaled: 10"
when 9
puts "case equaled: 9"
when 5
puts "case equaled: 5"
when 1
puts "case equaled: 1"
else
puts "Value wasn't cased."
end
puts "======== different types of comparisons"
if 4 == 4
puts "equal (4 == 4)"
end
if 4 != 3
puts "not equal (4 != 3)"
end
if 3 < 4
puts "less than (3 < 4)"
end
if 4 > 3
puts "greater than (4 > 3)"
end
if ((4 > 3) || (3 < 4) || false)
puts "or statement ((4 > 3) || (3 < 4) || false)"
end
if ((4 > 3) && (3 < 4))
puts "and statement ((4 > 3) && (3 < 4))"
end
end
# ====================================================================================
# Looping
# ====================================================================================
# Remove the x from xrepl to run the code. Add the x back to ignore to code.
xrepl do
puts "======== times block"
3.times do |i|
puts i
end
puts "======== range block exclusive"
(0...3).each do |i|
puts i
end
puts "======== range block inclusive"
(0..3).each do |i|
puts i
end
end
# ====================================================================================
# Enumerables
# ====================================================================================
# Remove the x from xrepl to run the code. Add the x back to ignore to code.
xrepl do
puts "======== array each"
colors = ["red", "blue", "yellow"]
colors.each do |color|
puts color
end
puts '======== array each_with_index'
colors = ["red", "blue", "yellow"]
colors.each_with_index do |color, i|
puts "#{color} at index #{i}"
end
end
# Remove the x from xrepl to run the code. Add the x back to ignore to code.
xrepl do
puts "======== single parameter function"
def add_one_to n
n + 5
end
puts add_one_to(3)
puts "======== function with default value"
def function_with_default_value v = 10
v * 10
end
puts "passing three: #{function_with_default_value(3)}"
puts "passing nil: #{function_with_default_value}"
puts "======== Or Equal (||=) operator for nil values"
def function_with_nil_default_with_local a = nil
result = a
result ||= "or equal operator was exected and set a default value"
end
puts "passing 'hi': #{function_with_nil_default_with_local 'hi'}"
puts "passing nil: #{function_with_nil_default_with_local}"
end
# ====================================================================================
# Arrays
# ====================================================================================
# Remove the x from xrepl to run the code. Add the x back to ignore to code.
xrepl do
puts "======== Create an array with the numbers 1 to 10."
one_to_ten = (1..10).to_a
puts one_to_ten
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
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
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
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
puts "======== All combination of numbers 1 to 10."
one_to_ten = (1..10).to_a
all_combinations = one_to_ten.product(one_to_ten)
puts all_combinations
puts "======== All uniq combinations of numbers. 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
# ====================================================================================
# Advanced Arrays
# ====================================================================================
# Remove the x from xrepl to run the code. Add the x back to ignore to code.
xrepl do
puts "======== All unique Pythagorean Triples between 1 and 40 sorted by area of the triangle."
one_to_hundred = (1..40).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, area|
puts "(#{width}, #{height}, #{hypotenuse}) = #{area}"
end
end

29
app/tests.rb

@ -0,0 +1,29 @@
# For advanced users:
# You can put some quick verification tests here, any method
# that starts with the `test_` will be run when you save this file.
# Here is an example test and game
# To run the test: ./dragonruby mygame --eval app/tests.rb --no-tick
class MySuperHappyFunGame
attr_gtk
def tick
outputs.solids << [100, 100, 300, 300]
end
end
def test_universe args, assert
game = MySuperHappyFunGame.new
game.args = args
game.tick
assert.true! args.outputs.solids.length == 1, "failure: a solid was not added after tick"
assert.false! 1 == 2, "failure: some how, 1 equals 2, the world is ending"
puts "test_universe completed successfully"
end
puts "running tests"
$gtk.reset 100
$gtk.log_level = :off
$gtk.tests.start

1
data/.gitkeep

@ -0,0 +1 @@
Put level data and other txt files here.

1
fonts/.gitkeep

@ -0,0 +1 @@
Put your custom fonts here.

10
metadata/game_metadata.txt

@ -0,0 +1,10 @@
# This file was automatically @generated by Smaug.
# Do not manually edit this file. Edit Smaug.toml instead.
devid=todo-change-me
devtitle=TODO: ${REPO_OWNER} &lt;todo@example.com&gt;
gameid=${REPO_NAME_SNAKE}
gametitle=${REPO_NAME_TITLE}
version=0.1.0
icon=metadata/icon.png
compile_ruby=false

BIN
metadata/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

14
metadata/ios_metadata.txt

@ -0,0 +1,14 @@
# ios_metadata.txt is used by the Pro version of DragonRuby Game Toolkit to create iOS apps.
# Information about the Pro version can be found at: http://dragonruby.org/toolkit/game#purchase
# teamname needs to be set to your assigned team id which can be found at https://developer.apple.com/account/#/membership/L7H57V9CRD
teamid=
# appid needs to be set to your application identifier which can be found at https://developer.apple.com/account/resources/identifiers/list
appid=
# appname is the name you want to show up underneath the app icon on the device
appname=
# devcert is the certificate to use for development/deploying to your local device
devcert=
# prodcert is the certificate to use for distribution to the app store
prodcert=

4
smaug.rb

@ -0,0 +1,4 @@
# This file was automatically @generated by Smaug.
# Do not manually edit this file. Edit Smaug.toml instead.

1
sounds/.gitkeep

@ -0,0 +1 @@
Put your sounds here.

BIN
sprites/misc/dragon-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
sprites/misc/dragon-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
sprites/misc/dragon-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
sprites/misc/dragon-3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
sprites/misc/dragon-4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
sprites/misc/dragon-5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
sprites/misc/explosion-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

BIN
sprites/misc/explosion-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
sprites/misc/explosion-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
sprites/misc/explosion-3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
sprites/misc/explosion-4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
sprites/misc/explosion-5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
sprites/misc/explosion-6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
sprites/misc/explosion-sheet.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Loading…
Cancel
Save