/
start_game.rb
58 lines (42 loc) · 1.42 KB
/
start_game.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
#
#
GAMEROOT = File.dirname(File.expand_path($0))
ENV['PATH'] = File.join(GAMEROOT,"lib") + ";" + ENV['PATH']
require 'rubygems' unless RUBY_VERSION =~ /1\.9/
require 'chingu'
require 'texplay'
DEBUG = false
include Gosu
include Chingu
require_all File.join(ROOT, 'src')
exit if defined?(Ocra)
class Game < Chingu::Window
attr_reader :player, :map
def initialize
super(320 * 3, 180 * 3, false)
self.factor = 3
Gosu::enable_undocumented_retrofication
$window.caption = "the light at the end of the tunnel. ~~ http://ippa.se/gaming ~~ a LD#16 entry, theme 'Exploration'."
self.input = { :esc => :close, :p => Chingu::GameStates::Pause }
@player = Player.create(:x => 100, :y => 100, :zorder => 100, :visible => false)
Sound["jump.wav"] # <-- lame caching untill chingu gets "cache_media()" or simular
Sound["land.wav"]
Sound["die.wav"]
Sound["falling.wav"]
Sound["poop.wav"]
map = [ [LevelUp, nil, nil, nil],
[Level1, Level2,Level22, nil],
[LevelAir, nil, Level3, nil],
[LevelAir2, Level5, Level4, nil],
[nil, Level6, Level7, nil],
[nil, Level8, Level9, Poop],
]
@map = Map.new(:map => map, :row => 1, :col => 0)
#@map = Map.new(:map => map, :row => 5, :col => 2)
#@player.x = 3
#@player.y = 200
switch_game_state(@map.current)
end
end
Game.new.show