Skip to content

Commit 599dc02

Browse files
committed
Incluindo 20131 Crazy Crash
Incluindo o jogo Crazy Crash
1 parent dbf022f commit 599dc02

35 files changed

+758
-0
lines changed

20132/crazycrash/Fruta.png

1.39 KB
Loading
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$LOAD_PATH << '.'
2+
3+
require 'crazy_crash' #primeira fase
4+
require 'crazy_crash2'#segunda fase
5+
require 'pre' #texto do início
6+
7+
jogo = Pre.new
8+
jogo.show

20132/crazycrash/Jogador2.png

38.7 KB
Loading

20132/crazycrash/Jogador3.png

2.74 KB
Loading

20132/crazycrash/Mapa.png

13.4 KB
Loading

20132/crazycrash/Mapa.txt

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
a...........................................................................................................................#........................................a
2+
a...........................................................................................................................#........................................a
3+
a...........................................................................................................................#........................................a
4+
a...............................................................................................#......#.x..................#........................................a
5+
a......................................................................................#.......#....####..x............#....#.............................#..........a
6+
a.......................x....x........................................................#.x.x.x.#...xx#......x...........#....#..###.n#####n................#..........a
7+
a.......................#....#........""........##.#.#...............................#..######....###.......x.........#.....#..###"n.nnnn.#...#######.....#..........a
8+
a.................xx....#....#.............xx...##.................xx...............#........................x.x.x.x.x#.......###.........#...#...........#......c...a
9+
a.........##.x.x.n##....#....#.x.x.x.x.x.x.##...##.......#.......n###....#.x.x.x.x.#...x.x.x.x.x.x.x.x.x...##...#######.......##xxxxxxxxxx#...#...........#..........a
10+
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbba

20132/crazycrash/Mapa2.png

3.74 KB
Loading

20132/crazycrash/Mapa2.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
a.............................................................................................................................................................a
2+
a.............................................................................................................................................................a
3+
a...............................#.............................................................................................................................a
4+
a...............................#.............................................................................................................................a
5+
a.............#####n###.........#.............................x.x.x.x....x.x.x................................................................................a
6+
a################...#######.....#.........#######..#######...#########..######................................................................................a
7+
a...............................#........#......#.n#..........n.............n.................................................................................a
8+
a...............................#.......#....................###################...........................#########################.........########.........a
9+
a....############################...............n...............................#.................#####.#.....#.#.#.#.#.#..................###................a
10+
a...................................####........#...........................................#####n..x.x.#............................#####........c...........a
11+
a..................................#####.x.x.x.x#.n.n.n.n.......................#..........n#####..x.x.x#....#x#x#x#x#n#x#....n....#######.n.n.n..............a
12+
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbba

20132/crazycrash/Mario.ogg

1.11 MB
Binary file not shown.

20132/crazycrash/bk2.png

18.4 KB
Loading

20132/crazycrash/bk3.png

19.3 KB
Loading

20132/crazycrash/cogu.rb

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Cogu
2+
attr_reader :x, :y
3+
4+
def initialize(imagem, x, y)
5+
@imagem = imagem
6+
@x, @y = x, y
7+
end
8+
def draw
9+
@imagem.draw(@x, @y, 4, 1)
10+
end
11+
end

20132/crazycrash/crash.ogg

448 KB
Binary file not shown.

20132/crazycrash/crazy_crash.rb

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
require 'gosu'
2+
require 'jogador'
3+
require 'mapa'
4+
5+
class Crazycrash < Gosu::Window
6+
attr_reader :map, :placar
7+
8+
def initialize
9+
super(640, 480, false)
10+
self.caption = "Crazy Crash"
11+
@y = 0
12+
@x = 0
13+
@beep = Gosu::Song.new(self, "mario.ogg") #música primeira fase
14+
@beep3 = Gosu::Song.new(self, "go.ogg") #música fim de jogo
15+
@sky = Gosu::Image.new(self, "trainc.png", true) #imagem deo trem
16+
@pre = Gosu::Image.new(self, "pre.png", true)
17+
@imagem = Gosu::Image.new(self, "inic.png", true) #imagem do estado inicio
18+
@imagem2 = Gosu::Image.new(self, "go.png", true) #imagem do estdo fim de jogo
19+
@imagem3 = Gosu::Image.new(self, "bk2.png", true) #imagem dos ícones do placar
20+
@map = Mapa.new(self, "Mapa.txt")
21+
@jogador = Jogador.new(self, 400, 100)
22+
@camera_x = @camera_y = 0
23+
@tempo = 46.0
24+
@estado = "INICIO"
25+
@font = Gosu::Font.new(self, Gosu::default_font_name, 20)
26+
end
27+
def draw
28+
if (@estado == "INICIO") then
29+
@imagem.draw(0,0,0)
30+
elsif (@estado == "JOGANDO") then #espaçoes para enquadrar os ícones da imagem
31+
@font.draw(" #{@jogador.placar}", 10, 10, 10, 2.0, 2.0, 0xffff0d0d)
32+
@font.draw(" #{@tempo.to_i}", 200, 10, 10, 2.0, 2.0, 0xffff0d0d)
33+
@font.draw(" #{@jogador.vid}", 400, 10, 10, 2.0, 2.0, 0xffff0d0d)
34+
@sky.draw(@y-8433,0,0)
35+
@imagem3.draw(0,0,0)
36+
translate(-@camera_x, -@camera_y) do
37+
@beep.play
38+
@map.draw
39+
@jogador.draw
40+
end
41+
elsif (@estado == "FIM")
42+
@imagem2.draw(0,0,0)
43+
end
44+
end
45+
def button_down(id)
46+
if id == Gosu::KbUp then @jogador.try_to_jump end
47+
if id == Gosu::KbEscape then close end
48+
end
49+
def update
50+
if(@estado == "INICIO")
51+
if (button_down?(Gosu::Button::KbI)) then
52+
@estado = "JOGANDO"
53+
end
54+
elsif (@estado == "JOGANDO")
55+
@y = (@y-3 )%8433
56+
@beep.play
57+
move_x = 5
58+
move_x -= 10 if button_down? Gosu::KbLeft
59+
move_x += 5 if button_down? Gosu::KbRight
60+
@jogador.update(move_x)
61+
@jogador.collect_fruts(@map.fruts) #coletar frutas
62+
@jogador.collect_nit(@map.nit) #coletar nitro
63+
@jogador.collect_cogu(@map.cogu) #coletar cogumelo
64+
@camera_x = [[@jogador.x - 320, 0].max, @map.width * 50 - 640].min
65+
@camera_y = [[@jogador.y - 240, 0].max, @map.height * 50 - 480].min
66+
@tempo-=1.0/60.0
67+
if (@tempo.to_i == 0) then
68+
@estado = "FIM"
69+
end
70+
if (@jogador.vid == 0) then
71+
@estado = "FIM"
72+
end
73+
if (@jogador.placar == 1000) then
74+
@beep.stop
75+
close
76+
jogo = Crazycrash2.new
77+
jogo.show
78+
end
79+
elsif (@estado == "FIM")
80+
@beep.stop
81+
@beep3.play
82+
if (button_down?(Gosu::Button::KbI)) then
83+
@beep3.stop
84+
close
85+
jogo = Crazycrash.new
86+
jogo.show
87+
end
88+
end
89+
end
90+
end

20132/crazycrash/crazy_crash2.rb

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
require 'gosu'
2+
require 'jogador'
3+
require 'jogador2'
4+
require 'mapa2'
5+
6+
class Crazycrash2 < Gosu::Window #Código para segunda fase
7+
attr_reader :map, :placar
8+
9+
def initialize
10+
super(640, 480, false)
11+
self.caption = "Crazy Crash"
12+
@y = 0
13+
@beep = Gosu::Song.new(self, "crash.ogg") #música segunda fase
14+
@beep2 = Gosu::Song.new(self, "end.ogg") #música conclusão do jogo
15+
@beep3 = Gosu::Song.new(self, "go.ogg") #música fim de jogo
16+
@sky = Gosu::Image.new(self, "trainc2.png", true) #trem da segunda fase
17+
@imagem = Gosu::Image.new(self, "inic2.png", true) #imagem de início da segunda fase
18+
@imagem2 = Gosu::Image.new(self, "go.png", true)
19+
@imagem3 = Gosu::Image.new(self, "bk3.png", true) #background seguda fase
20+
@imagem4 = Gosu::Image.new(self, "go2.png", true) #background conclusão de jogo
21+
@map = Mapa2.new(self, "Mapa2.txt")
22+
@jogador = Jogador2.new(self, 400, 100)
23+
@camera_x = @camera_y = 0
24+
@tempo = 46.0
25+
@estado = "INICIO"
26+
@font = Gosu::Font.new(self, Gosu::default_font_name, 20)
27+
end
28+
def draw
29+
if (@estado == "INICIO") then
30+
@imagem.draw(0,0,0)
31+
elsif (@estado == "JOGANDO") then
32+
@font.draw(" #{@jogador.placar}", 10, 10, 10, 2.0, 2.0, 0xffff0d0d)
33+
@font.draw(" #{@tempo.to_i}", 200, 10, 10, 2.0, 2.0, 0xffff0d0d)
34+
@font.draw(" #{@jogador.vid}", 400, 10, 10, 2.0, 2.0, 0xffff0d0d)
35+
@sky.draw(@y-8433,0,0)
36+
@imagem3.draw(0,0,0)
37+
translate(-@camera_x, -@camera_y) do
38+
@beep.play
39+
@map.draw
40+
@jogador.draw
41+
end
42+
elsif (@estado == "FIM") then
43+
@imagem2.draw(0,0,0)
44+
elsif (@estado == "END") then #estado adiconal para conclusão do jogo
45+
@imagem4.draw(0,0,0)
46+
end
47+
end
48+
def button_down(id)
49+
if id == Gosu::KbUp then
50+
@jogador.try_to_jump
51+
end
52+
if id == Gosu::KbEscape then
53+
close
54+
end
55+
end
56+
def update
57+
if (@estado == "INICIO")
58+
if (button_down?(Gosu::Button::KbI)) then
59+
@estado = "JOGANDO"
60+
end
61+
elsif (@estado == "JOGANDO")
62+
@y = (@y-3 )%8433
63+
@beep.play
64+
move_x = 5
65+
move_x -= 10 if button_down? Gosu::KbLeft
66+
move_x += 5 if button_down? Gosu::KbRight
67+
@jogador.update(move_x)
68+
@jogador.collect_fruts(@map.fruts)
69+
@jogador.collect_nit(@map.nit)
70+
@jogador.collect_cogu(@map.cogu)
71+
@camera_x = [[@jogador.x - 320, 0].max, @map.width * 50 - 640].min
72+
@camera_y = [[@jogador.y - 240, 0].max, @map.height * 50 - 480].min
73+
@tempo-=1.0/60.0
74+
if (@tempo.to_i == 0) then
75+
@estado = "FIM"
76+
end
77+
if (@jogador.vid == 0) then
78+
@estado = "FIM"
79+
end
80+
if (@jogador.placar == 1000) then
81+
@beep.stop
82+
@estado = "END"
83+
end
84+
elsif (@estado == "FIM")
85+
@beep.stop
86+
@beep3.play
87+
if (button_down?(Gosu::Button::KbI)) then
88+
@beep3.stop
89+
close
90+
jogo = Crazycrash.new
91+
jogo.show
92+
end
93+
elsif (@estado == "END") then
94+
@beep2.play
95+
if (button_down?(Gosu::Button::KbI)) then #após concluído, reniciar o jogo
96+
@beep2.stop
97+
close
98+
jogo = Crazycrash.new
99+
jogo.show
100+
end
101+
end
102+
end
103+
end

20132/crazycrash/end.ogg

1.18 MB
Binary file not shown.

20132/crazycrash/fase2.rb

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
require 'gosu'
2+
require 'jogador'
3+
require 'mapa'
4+
5+
class Fase2 < Gosu::Window
6+
attr_reader :map, :placar
7+
8+
def initialize
9+
super(640, 480, false)
10+
self.caption = "Crazy Crash"
11+
@y = 0
12+
@beep = Gosu::Song.new(self, "mario.ogg")
13+
@sky = Gosu::Image.new(self, "trainc.png", true)
14+
@imagem = Gosu::Image.new(self, "inic.png", true)
15+
@imagem2 = Gosu::Image.new(self, "go.png", true)
16+
@imagem3 = Gosu::Image.new(self, "bk2.png", true)
17+
@map = Mapa.new(self, "Mapa.txt")
18+
@jogador = Jogador.new(self, 400, 100)
19+
@camera_x = @camera_y = 0
20+
@tempo = 46.0
21+
@estado = "INICIO"
22+
@font = Gosu::Font.new(self, Gosu::default_font_name, 20)
23+
end
24+
def draw
25+
if (@estado == "INICIO") then
26+
@imagem.draw(0,0,0)
27+
msg = "PRESSIONE [I] PARA INICIAR"
28+
elsif (@estado == "JOGANDO") then
29+
@font.draw(" #{@jogador.placar}", 10, 10, 10, 2.0, 2.0, 0xffff0d0d)
30+
@font.draw(" #{@tempo.to_i}", 200, 10, 10, 2.0, 2.0, 0xffff0d0d)
31+
@font.draw(" #{@jogador.vid}", 400, 10, 10, 2.0, 2.0, 0xffff0d0d)
32+
@sky.draw(@y-8433,0,0)
33+
@imagem3.draw(0,0,0)
34+
translate(-@camera_x, -@camera_y) do
35+
@beep.play
36+
@map.draw
37+
@jogador.draw
38+
end
39+
elsif (@estado == "FIM")
40+
@imagem2.draw(0,0,0)
41+
msg = "FIM DE JOGO, TENTE NOVAMENTE"
42+
end
43+
end
44+
def button_down(id)
45+
if id == Gosu::KbUp then @jogador.try_to_jump end
46+
if id == Gosu::KbEscape then close end
47+
end
48+
def update
49+
if (@estado == "INICIO")
50+
if (button_down?(Gosu::Button::KbI)) then
51+
@estado = "JOGANDO"
52+
end
53+
elsif (@estado == "JOGANDO")
54+
@y = (@y-3 )%8433
55+
@beep.play
56+
move_x = 5
57+
move_x -= 10 if button_down? Gosu::KbLeft
58+
move_x += 5 if button_down? Gosu::KbRight
59+
@jogador.update(move_x)
60+
@jogador.collect_fruts(@map.fruts)
61+
@jogador.collect_nit(@map.nit)
62+
@jogador.collect_cogu(@map.cogu)
63+
@camera_x = [[@jogador.x - 320, 0].max, @map.width * 50 - 640].min
64+
@camera_y = [[@jogador.y - 240, 0].max, @map.height * 50 - 480].min
65+
@tempo-=1.0/60.0
66+
if (@tempo.to_i == 0) then
67+
@estado = "FIM"
68+
end
69+
if (@jogador.vid == 0) then
70+
@estado = "FIM"
71+
end
72+
if (@jogador.placar == 1000) then
73+
close
74+
jogo = Crazycrash.new
75+
jogo.show
76+
end
77+
elsif (@estado == "FIM")
78+
if (button_down?(Gosu::Button::KbI)) then
79+
close
80+
jogo = Crazycrash.new
81+
jogo.show
82+
end
83+
end
84+
end
85+
end

20132/crazycrash/fruta.rb

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Fruta
2+
attr_reader :x, :y, :placar, :vid
3+
4+
def initialize(imagem, x, y)
5+
@imagem = imagem
6+
@x, @y = x, y
7+
@placar = 0
8+
end
9+
def draw
10+
@imagem.draw(@x, @y, 4, 1)
11+
end
12+
end

20132/crazycrash/go.ogg

109 KB
Binary file not shown.

20132/crazycrash/go.png

101 KB
Loading

20132/crazycrash/go2.png

243 KB
Loading

20132/crazycrash/inic.png

160 KB
Loading

20132/crazycrash/inic2.png

87.7 KB
Loading

0 commit comments

Comments
 (0)