Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added explain/amasagi_ex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added explain/koi_ex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added explain/morogeebi_ex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added explain/shizimi_ex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added explain/sirauo_ex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added explain/suzuki_ex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added explain/unagi_ex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require 'dxruby'

require_relative 'scene'
require_relative 'scenes/load_scene'



Window.caption = "RubyCamp Example"
Window.width = 900
Window.height = 563

bgm = Sound.new("sounds/bgm.mid")

Scene.move_to(:travel)
# bgm.play

Window.loop do
Scene.play

break if Input.key_push?(K_ESCAPE)
end
19 changes: 19 additions & 0 deletions scene.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Scene
@@scenes = {}

@@current_scene_name = nil

def self.add(scene_obj, scene_name)
@@scenes[scene_name.to_sym] = scene_obj
end


def self.move_to(scene_name)
@@current_scene_name = scene_name.to_sym
end


def self.play
@@scenes[@@current_scene_name].play
end
end
57 changes: 57 additions & 0 deletions scenes/credit/director.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
module Credit
class Director
FONT_SIZE = 30
def initialize
@words = %w(
player nanami0408さんによる写真ACからの写真 https://www.ac-illust.com/
うなぎ 三浦さくさんによるイラストACからのイラスト 〃
わかさぎ HiCさんによる写真ACからの写真 〃
しらうお Hinamaluさんによる写真ACからの写真 〃
こい わーい!たむたむさんによる写真ACからの写真  〃
すずき photolibrary https://www.photolibrary.jp
しじみ ねこ画伯コハクちゃん https://kohacu.com/20170513post-9047
えび パブリックドメインQ:著作権フリー画像素材集 
https://publicdomainq.net/boiled-shrimp-food-0015019/
背景 〃 〃
タイトル背景 ばんない堂 https://098free.com/rule/


製作者

松田陸斗
青砥朋紀
平池竜大
吉見昂大
福間陽菜












Thank you
)
@font = Font.new(FONT_SIZE, 'MS 明朝', weight: true)
@scroll_y = 0
end

def play
@scroll_y += 1 unless Input.key_down?(K_SPACE)
@scroll_y += 5 if Input.key_down?(K_RETURN)
frame_out = []

@words.each_with_index do |word, i|
draw_x = Window.width / 30
draw_y = (Window.height + i * FONT_SIZE) - @scroll_y
# 文字にマウスオーバーしていたら赤色を指定する
Window.draw_font(draw_x, draw_y, word, @font)
end
end
end
end
15 changes: 15 additions & 0 deletions scenes/ending/director.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Ending
class Director
def initialize
@edImg = Image.load("scenes/ending/image/ending.png")
end

def play
Scene.move_to(:credit) if Input.key_push?(K_SPACE)

Scene.move_to(:opening) if Input.key_push?(K_Q)

Window.draw(0, 0,@edImg)
end
end
end
Binary file added scenes/ending/image/ending.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
25 changes: 25 additions & 0 deletions scenes/game/attack.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class Attack<Sprite
def initialize(x, y, image)
@dx = 2
super
end

def move
self.x+=@dx
end


def window_out
self.x > (Window.width - self.image.width)

end

def shot(obj)
self.vanish if obj.is_a?(Enemy)
end

# def hit(obj)
# puts "b"
# obj.vanish
# end
end
50 changes: 50 additions & 0 deletions scenes/game/background.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
class Background < Sprite
attr_accessor :dx
attr_accessor :dy

def move_right
self.x += dx
dx > 0? left_scroll_check : right_scroll_check
end

def left_scroll_check
self.x = -Window.width if self.x >= Window.width
end

def right_scroll_check
self.x = Window.width - 1 if self.x + Window.width < 0
end



def move_left
self.x += 1
left_scroll_check
end




def move_down
self.y+=dy
dy > 0? down_scroll_check : up_scroll_check
end

def up_scroll_check
self.y= -Window.height if self.y>= Window.height
end

def down_scroll_check
self.y = Window.heigt - 1 if self.y + Window.heigt< 0
end




def move_up
self.y+= 1
up_scroll_check
end


end
7 changes: 7 additions & 0 deletions scenes/game/chase_enemy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class ChaseEnemy < Enemy
def move(player)
super
self.x += 2 * @dx * ((player.x - self.x) > 0?1:-1)
self.y += 2 * @dy * ((player.y - self.y) > 0?1:-1)
end
end
170 changes: 170 additions & 0 deletions scenes/game/director.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
require_relative 'enemy'
require_relative 'normal_enemy'
require_relative 'speed_enemy'
require_relative 'chase_enemy'
require_relative 'player'
require_relative 'shittin'
require_relative 'display'
require_relative 'background'
require_relative 'attack'

module Game
class Director
NOMAL_ENEMY_NUMBER = 5
SPEED_ENEMY_NUMBER = 5
CHASE_ENEMY_NUMBER = 5
TIMER_SPEED = 0.4

def initialize
@bg_img = Image.load("scenes/game/image/backscreen_loop.png")
@backgrounds = [
Background.new(Window.width, 0, @bg_img),
Background.new(0, 0, @bg_img),
Background.new(Window.width, Window.height, @bg_img),
Background.new(0, Window.height, @bg_img),
]
@backgrounds.map{|obj| obj.dx = -1 }
@backgrounds.map{|obj| obj.dy = -1 }

suzuki_img = Image.load("scenes/game/image/suzuki.png")
@suzuki = Shittin.new(300, 300, suzuki_img)
morogeebi_img = Image.load("scenes/game/image/ebi.png")
@morogeebi = Shittin.new(200, 450, morogeebi_img)
unagi_img = Image.load("scenes/game/image/unagi.png")
@unagi = Shittin.new(300, 400, unagi_img)
amasagi_img = Image.load("scenes/game/image/wakasagi.png")
@amasagi = Shittin.new(500, 300, amasagi_img)
shizimi_img = Image.load("scenes/game/image/shizimi.png")
@shizimi = Shittin.new(300, 500, shizimi_img)
koi_img = Image.load("scenes/game/image/koi.png")
@koi = Shittin.new(100, 300, koi_img)
sirauo_img = Image.load("scenes/game/image/shirauo.png")
@sirauo = Shittin.new(300, 100, sirauo_img)
@shittin = [@suzuki, @morogeebi, @unagi, @amasagi, @shizimi, @koi, @sirauo]
@shittin.each_with_index do |shittin, i|
shittin.collision_enable = false
end
@hit_count = 0

# enemy_img = Image.load('scenes/game/image/kuribo1.png')
normal_enemy_img = Image.load("scenes/game/image/teki_harisenbon.png")
speed_enemy_img = Image.new(20, 20, [0, 255, 0])
chase_enemy_img = Image.new(20, 20, [0, 0, 255])
@enemys = []
NOMAL_ENEMY_NUMBER.times do
@enemys << NomalEnemy.new(rand(300)+150, rand(300)+150, normal_enemy_img)
end
SPEED_ENEMY_NUMBER.times do
@enemys << SpeedEnemy.new(rand(300)+150, rand(300)+150, speed_enemy_img)
end
CHASE_ENEMY_NUMBER.times do
@enemys << ChaseEnemy.new(rand(300)+150, rand(300)+150, chase_enemy_img)
end

player_img = Image.load('scenes/game/image/player.png')
@player = Player.new(100, 100, player_img)

@attack_image = Image.new(10, 10, [255, 0, 0])#("scenes/game/image/kuribo1.png")
@attacks = []

@player.collision = [20,20,20]
@enemys.each{|enemy| enemy.collision = [10,10,10]}

@font_push_space = Font.new(80)
@font_timer = Font.new(22, 'MS 明朝', weight: true, auto_fitting: true)


@sound = Sound.new("scenes/game/sound/sound.wav")

@timer_img = Image.new(600, 22, [0, 0, 255])
@time = 300

@fps_counter = 0
end

def play
Scene.move_to(:gameover) if @time >= 900
Scene.move_to(:gameover) if !(@player.check(@enemys).empty?)

# if Input.key_down?(K_RIGHT)
# @backgrounds.map(&:move_right)
# end
# if Input.key_down?(K_LEFT)
# @backgrounds.map(&:move_left)
# end
# if Input.key_down?(K_DOWN)
# @backgrounds.map(&:move_down)
# end
# if Input.key_down?(K_UP)
# @backgrounds.map(&:move_up)
# end

@backgrounds.map(&:draw)


if @hit_count <= 6
@shittin[@hit_count<=6 ? @hit_count : 6].move(@player)
@shittin[@hit_count<=6 ? @hit_count : 6].draw
@shittin[@hit_count<=6 ? @hit_count : 6].collision_enable = true
@shittin[@hit_count<=6 ? @hit_count-1 : 6].collision_enable = false
else
@shittin[6].collision_enable = false
end
if !(@shittin[@hit_count<=6 ? @hit_count : 6].check(@player).empty?)
Window.loop do
Window.draw(0,0,@bg_img)
break if Input.key_push?(K_SPACE)
end
@hit_count += 1
end

display(@hit_count)
Scene.move_to(:ending) if (@hit_count >= 7 && Input.key_push?(K_SPACE))

@enemys.each{|enemy| enemy.move(@player)}
@enemys.each{|enemy| enemy.draw}
@player.down if Input.key_down?(K_DOWN)
@player.up if Input.key_down?(K_UP)
@player.right if Input.key_down?(K_RIGHT)
@player.left if Input.key_down?(K_LEFT)
@player.draw

if Input.key_down?(K_LSHIFT) && @fps_counter % 30 == 0
@attacks << Attack.new(@player.x+40,@player.y+20,@attack_image)
end

Sprite.check(@attacks, @enemys)

@attacks.each_with_index do |attack, i|

attack.move
attack.draw



# if attack.window_out
# attack.vanish
# @attacks.delete(i)
# end
# if !(attack.check(@enemys).empty?)
# attack.check(@emenys).each_with_index do |enemy, i|
# enemy.vanish
# end
# end
end

if @fps_counter % 60 >= 30
Window.draw_font(230, 220, "PUSH SPACE", @font_push_space) if @hit_count >= 7
end

Window.draw(@time, 0, @timer_img)
@time += TIMER_SPEED

Window.draw_font(800, 0, 'タイマー', @font_timer)

@sound.play if !(@player.check(@shittin).empty?)

@fps_counter += 1
end
end
end
9 changes: 9 additions & 0 deletions scenes/game/display.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def display(hit_count)
chars = ["ス","モ","ウ","ア","シ","コ","シ"]

font = Font.new(50)

chars.first(hit_count).each_with_index do |char, i|
Window.draw_font((10+(i*50)),500,char,font)
end
end
Loading