summaryrefslogtreecommitdiffhomepage
path: root/run.rb
diff options
context:
space:
mode:
Diffstat (limited to 'run.rb')
-rw-r--r--run.rb58
1 files changed, 34 insertions, 24 deletions
diff --git a/run.rb b/run.rb
index 2c30699..06e0fc6 100644
--- a/run.rb
+++ b/run.rb
@@ -4,48 +4,58 @@ require 'ruby2d'
require_relative 'lib/camera/camera'
require_relative 'tileset'
+set width: 1024, height: 720
+
@eks = 0
@why = 0
on :key_down do |event|
if event.key == 'w'
@why -= 1
- @why %= 13
end
if event.key == 's'
@why += 1
- @why %= 13
end
if event.key == 'a'
@eks -= 1
- @eks %= 23
end
if event.key == 'd'
@eks += 1
- @eks %= 23
end
end
-@test = Sprite.new('./Monster02.png',
- clip_width: 48,
- clip_height: 48,
- width: 100,
- height: 100,
- x: 0,
- y: 0,
- loop: true)
-@test2 = Sprite.new('./Monster02-RGB.png',
- clip_width: 48,
- clip_height: 48,
- width: 100,
- height: 100,
- x: 100,
- y: 0,
- loop: true)
+on :mouse_up do |event|
+ case event.button
+ when :left
+ @new = @yep.create_image(@selected_item[0], @selected_item[1])
+ @new.x = Window.mouse_x - (Window.mouse_x % 128)
+ @new.y = Window.mouse_y - (Window.mouse_y % 128)
+ end
+end
+on :mouse_scroll do |event|
+ @selected_item[0] += event.delta_y
+ puts "=="
+ pp @selected_item
+ @selected_item[1] += @selected_item[0] / @yep.width
+ @selected_item[0] %= @yep.width
+ pp @selected_item
+ @selected_item[1] %= @yep.height
+ pp @selected_item
+end
+@yep = Tileset.new('./assets/kenny/PNG/128', 128, 128)
+ thing.each do |stuff|
+ pp stuff
+ end
+end
+
+@selected_item = [0,0]
+@selected_image = @yep.create_image(@selected_item[0], @selected_item[1])
+
update do
- #Camera << Image.new(Tileset.get[@eks][@why])
- #Camera.redraw
+ @selected_image.remove
+ @selected_image = @yep.create_image(@selected_item[0], @selected_item[1])
+ @selected_image.x = Window.mouse_x - (Window.mouse_x % 128)
+ @selected_image.y = Window.mouse_y - (Window.mouse_y % 128)
end
show