Skip to content

Instantly share code, notes, and snippets.

View max-bertinetti's full-sized avatar
🏠
Working from home

Max Bertinetti max-bertinetti

🏠
Working from home
  • Italy
View GitHub Profile
@max-bertinetti
max-bertinetti / main.rb
Last active November 29, 2022 08:38
DragonRuby Topdown 8 direction movement
# 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
@max-bertinetti
max-bertinetti / main.rb
Created November 29, 2022 08:29
DragonRuby Topdown 8 direction movement: second version
# 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 ||= [200, 200, 100, 100, 'dragonruby.png']
generate_map args