summaryrefslogtreecommitdiffhomepage
path: root/run.rb
blob: 2c3069913aff3d92ff7257db1cf6b961d272fdb5 (plain)
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
# frozen_string_literal: true

require 'ruby2d'
require_relative 'lib/camera/camera'
require_relative 'tileset'

@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)
@test.play
@test2.play
update do
  #Camera << Image.new(Tileset.get[@eks][@why])
  #Camera.redraw
end

show