-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_method.rb
89 lines (71 loc) · 1.09 KB
/
make_method.rb
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# -*- coding: utf-8 -*-
class Make_block
def initialize(image)
@block = []
@img = Image.load(image)
@x = 6
@y = 420
end
def make
@block.push(Block.new(200,100,@img)) #70 * 60
up(@x,@y,5)
down(@x,@y,3)
tobitobi(@x,@y,2,4)
up(@x,@y,3)
tate(@x,@y,6)
space(@x,@y,2)
up(@x,@y,4)
yoko(@x,@y,3)
down(@x,@y,2)
tate(@x,@y,6)
space(@x,@y,4)
@block
#puts @x
#puts @y
end
def up(x,y,dan)
dan.times{
@block.push(Block.new(@x,@y,@img))
@x = @x+70
@y = @y-60
}
end
def yoko(x,y,kosuu)
kosuu.times{
@block.push(Block.new(@x,@y,@img))
@x = @x+70
}
end
def tate(x,y,kosuu)
kosuu.times{
@block.push(Block.new(@x,@y,@img))
@y = @y+60
}
end
def down(x,y,dan)
dan.times{
@block.push(Block.new(@x,@y,@img))
@x = @x+70
@y = @y+60
}
end
def space(x,y,kosuu)
kosuu.times{
@x = @x+70
@y = 420
}
end
def tobitobi(x,y,aki,kosuu)
kosuu.times{
@block.push(Block.new(@x,@y,@img))
@x = @x+70*aki
}
@x = @x-70*aki
end
def x
@x
end
def y
@y
end
end