Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create player!!!!!! #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

41 changes: 41 additions & 0 deletions director.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require_relative 'teki'
require_relative 'player'

class Director
def initialize
@bg_img = Image.load("image/backscreen_loop.png")
@suzuki = Shittin.new(300, 300, "image/suzuki.png",1)
@morogeebi = Shittin.new(1000, 300, "image/ebi.png",0)
@unagi = Shittin.new(300, 400, "image/unagi.png",0)
@amasazi = Shittin.new(500, 300, "image/wakasagi.png",0)
@shizimi = Shittin.new(300, 500, "image/shizimi.png",0)
@koi = Shittin.new(100, 300, "image/koi.png",0)
@sirauo = Shittin.new(300, 100, "image/shirauo.png",0)
@teki=Teki.new(150,150,"image/kuribo1.png")
@player_image = Image.load('ghost.png')
@player = Player.new(100, 100, @player_image)
end

def play
Window.draw(0, 0, @bg_img)
Window.draw(800, 0, @bg_img)
Window.draw(0, 563, @bg_img)
Window.draw(800, 600, @bg_img)
@suzuki.draw
@morogeebi.draw
@unagi.draw
@amasazi.draw
@shizimi.draw
@koi.draw
@sirauo.draw
@teki.draw
@teki.move
@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


end
end
Binary file added ghost.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 image/Mario1.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 image/background.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 image/backscreen_loop.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 image/ebi.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 image/koi.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 image/kuribo1.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 image/player.jpg
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 image/player_new.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 image/shirauo.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 image/shizimi.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 image/suzuki.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 image/unagi.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 image/wakasagi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'dxruby'

require_relative 'director'
require_relative 'shittin'
#require_relative 'player'


Window.caption = "RubyCamp Example"
Window.width = 800
Window.height = 600

director = Director.new


Window.loop do
director.play
end
15 changes: 15 additions & 0 deletions player.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Player < Sprite

def up
self.y -= 5
end
def down
self.y += 5
end
def right
self.x += 5
end
def left
self.x -= 5
end
end
16 changes: 16 additions & 0 deletions shittin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Shittin
def initialize(x, y, image_file,z)
@x, @y,@z = x, y,z
@image = Image.load(image_file)
@image.set_color_key([0, 0, 0])
@dx = 1

end


def draw
Window.draw(@x, @y, @image,@z)


end
end
17 changes: 17 additions & 0 deletions teki.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Teki
def initialize(x, y, image_file)
@x, @y = x, y
@image = Image.load(image_file)
@image.set_color_key([0, 0, 0])
@dx = 1
end
def draw
Window.draw(@x, @y, @image)
end

def move
@x+=rand(4)-2
@y+=rand(4)-2
end
end