petli 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/bin/anim +29 -0
- data/bin/bootstrap.rb +3 -0
- data/bin/console +1 -1
- data/bin/petli +1 -2
- data/data/adult/001_diddly.txtanim +91 -0
- data/data/adult/002_kirby.txtanim +91 -0
- data/data/adult/003_tama.txtanim +85 -0
- data/data/adult/004_big.txtanim +62 -0
- data/data/adult/005_angel.txtanim +91 -0
- data/data/death.txtanim +9 -0
- data/data/hatch.txtanim +8 -0
- data/data/infant/001_baby.txtanim +80 -0
- data/data/poop.txtanim +6 -0
- data/data/sleep.txtanim +16 -0
- data/data/teen/001_baloop.txtanim +91 -0
- data/data/teen/002_roboty.txtanim +91 -0
- data/lib/petli/pet/animation.rb +94 -0
- data/lib/petli/pet/death.rb +21 -0
- data/lib/petli/pet/food.rb +42 -0
- data/lib/petli/pet/happy.rb +34 -0
- data/lib/petli/pet.rb +18 -116
- data/lib/petli/stages/base.rb +31 -12
- data/lib/petli/stages/dice.rb +1 -1
- data/lib/petli/stages/guess.rb +1 -1
- data/lib/petli/stages/main.rb +4 -1
- data/lib/petli/version.rb +1 -1
- data/lib/petli/watch.rb +5 -0
- data/lib/petli.rb +9 -4
- data/lib/tatty/anim.rb +48 -6
- data/lib/tatty/atlas.rb +74 -0
- data/lib/tatty/stage.rb +3 -0
- data/lib/tatty.rb +1 -0
- data/petli.gemspec +1 -1
- metadata +26 -10
- data/data/character.json +0 -40
- data/data/face_ref +0 -73
- data/lib/petli/animator.rb +0 -137
- data/lib/petli/poop.rb +0 -9
data/lib/petli.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
module Petli
|
2
|
-
autoload :Animator, "petli/animator"
|
3
|
-
autoload :HUD, "petli/hud"
|
4
2
|
autoload :Pet, "petli/pet"
|
5
|
-
autoload :Poop, "petli/poop"
|
6
3
|
autoload :Stages, "petli/Stages"
|
7
|
-
autoload :Watch, "petli/watch"
|
8
4
|
autoload :VERSION, "petli/version"
|
5
|
+
autoload :Watch, "petli/watch"
|
6
|
+
|
7
|
+
def self.root
|
8
|
+
File.expand_path(File.join(__dir__, '..'))
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.data_path(*filepaths)
|
12
|
+
File.join(root, 'data', *filepaths)
|
13
|
+
end
|
9
14
|
end
|
data/lib/tatty/anim.rb
CHANGED
@@ -1,18 +1,60 @@
|
|
1
1
|
module Tatty
|
2
2
|
class Anim
|
3
|
-
|
3
|
+
attr_reader :width, :height, :loop, :rate, :name
|
4
|
+
|
5
|
+
def self.from_atlas(filepath, name: :default)
|
6
|
+
Atlas.new(filepath)[name]
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(atlas, width:, height:, **kargs)
|
4
10
|
@atlas = atlas
|
5
|
-
@
|
6
|
-
@
|
11
|
+
@rate = kargs[:speed] || 2
|
12
|
+
@loop = kargs[:loop] || false
|
13
|
+
if kargs[:loop_for].nil?
|
14
|
+
@loop_for = -1
|
15
|
+
else
|
16
|
+
@loop = false
|
17
|
+
@loop_for_start = kargs[:loop_for] || -1
|
18
|
+
@loop_for = @loop_for_start
|
19
|
+
end
|
20
|
+
@name = kargs[:name]
|
21
|
+
@width = width
|
22
|
+
@height = height
|
23
|
+
reset
|
24
|
+
end
|
25
|
+
|
26
|
+
def reset
|
27
|
+
@frame = 0
|
28
|
+
@loop_for = @loop_for_start if @loop_for == 0
|
7
29
|
end
|
8
30
|
|
9
31
|
def step
|
10
32
|
@frame += 1
|
11
|
-
|
12
|
-
|
33
|
+
if rate_frame >= @atlas.count
|
34
|
+
reset if self.loop
|
35
|
+
@loop_for -= 1 if @loop_for > 0
|
36
|
+
true
|
37
|
+
else
|
38
|
+
false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def display
|
43
|
+
@atlas[rate_frame]
|
44
|
+
end
|
45
|
+
|
46
|
+
def next
|
47
|
+
step
|
48
|
+
display
|
13
49
|
end
|
14
50
|
|
15
|
-
def
|
51
|
+
def loop
|
52
|
+
@loop || @loop_for > 0
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def rate_frame
|
16
58
|
(@frame/@rate).ceil
|
17
59
|
end
|
18
60
|
end
|
data/lib/tatty/atlas.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Tatty
|
4
|
+
class Atlas
|
5
|
+
def initialize(filepath)
|
6
|
+
@filepath = File.expand_path(filepath)
|
7
|
+
@sheet = {}
|
8
|
+
parse_data
|
9
|
+
end
|
10
|
+
|
11
|
+
def [](name)
|
12
|
+
@sheet[name.to_sym]
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def parse_data
|
18
|
+
chunks = File.read(@filepath).split(/^---.*$/)
|
19
|
+
shouldBeYaml = true
|
20
|
+
default_config = {name: :default}.merge(parse_yaml(chunks.first))
|
21
|
+
default_config.delete(:alias)
|
22
|
+
config = {}
|
23
|
+
chunks.each do |chunk|
|
24
|
+
if shouldBeYaml
|
25
|
+
config = default_config.merge(parse_yaml(chunk))
|
26
|
+
else
|
27
|
+
validate_config(config)
|
28
|
+
animation = Anim.new(parse_animation(chunk, config), **config)
|
29
|
+
([config[:name]] + Array(config[:alias])).map(&:to_sym).each do |name|
|
30
|
+
@sheet[name] = animation
|
31
|
+
end
|
32
|
+
end
|
33
|
+
shouldBeYaml = !shouldBeYaml
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def validate_config(config)
|
38
|
+
name = config[:name].to_sym
|
39
|
+
if name.nil?
|
40
|
+
raise "All animations in an atlas need to have a name attribute"
|
41
|
+
elsif !@sheet[name].nil?
|
42
|
+
raise "Duplicate animation name '#{name}'"
|
43
|
+
elsif config[:width].nil? || config[:height].nil?
|
44
|
+
raise "Animation '#{name}' does not have a width and/or height attribute"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def parse_yaml(chunk)
|
49
|
+
YAML.load(chunk).each_with_object({}) { |(k,v), h| h[k.to_sym] = v }
|
50
|
+
rescue
|
51
|
+
raise "unable to parse chunk #{chunk}"
|
52
|
+
end
|
53
|
+
|
54
|
+
def parse_animation(chunk, config)
|
55
|
+
width, height = config[:width], config[:height]
|
56
|
+
frames = []
|
57
|
+
frame_offset = 0
|
58
|
+
chunk.lines.each_slice(height+1).to_a.each do |frame_line|
|
59
|
+
frame_line.each do |line|
|
60
|
+
i = 0
|
61
|
+
while line.length > 1
|
62
|
+
frames[frame_offset+i] ||= []
|
63
|
+
frames[frame_offset+i] << line.slice!(0, width)
|
64
|
+
line.slice!(0, 1) # separator
|
65
|
+
i+=1
|
66
|
+
end
|
67
|
+
end
|
68
|
+
frame_offset = frames.count
|
69
|
+
end
|
70
|
+
frames.map {|f| f.join("\n") }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
data/lib/tatty/stage.rb
CHANGED
data/lib/tatty.rb
CHANGED
data/petli.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
HERE
|
25
25
|
s.metadata = { "source_code_uri" => "https://github.com/tanema/petli" }
|
26
26
|
|
27
|
-
s.files = Dir.glob('{bin/*,lib/**/*,data
|
27
|
+
s.files = Dir.glob('{bin/*,lib/**/*,data/**/*,[A-Z]*}')
|
28
28
|
s.bindir = "bin"
|
29
29
|
s.executables = ["petli"]
|
30
30
|
s.require_paths = ['lib']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: petli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Anema
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pastel
|
@@ -110,7 +110,7 @@ dependencies:
|
|
110
110
|
version: 0.3.0
|
111
111
|
description: 'A virtual pet that will live in your command line!
|
112
112
|
|
113
|
-
'
|
113
|
+
'
|
114
114
|
email:
|
115
115
|
- timanema@gmail.com
|
116
116
|
executables:
|
@@ -123,14 +123,28 @@ files:
|
|
123
123
|
- LICENSE
|
124
124
|
- README.md
|
125
125
|
- Rakefile
|
126
|
+
- bin/anim
|
127
|
+
- bin/bootstrap.rb
|
126
128
|
- bin/console
|
127
129
|
- bin/petli
|
128
|
-
- data/
|
129
|
-
- data/
|
130
|
+
- data/adult/001_diddly.txtanim
|
131
|
+
- data/adult/002_kirby.txtanim
|
132
|
+
- data/adult/003_tama.txtanim
|
133
|
+
- data/adult/004_big.txtanim
|
134
|
+
- data/adult/005_angel.txtanim
|
135
|
+
- data/death.txtanim
|
136
|
+
- data/hatch.txtanim
|
137
|
+
- data/infant/001_baby.txtanim
|
138
|
+
- data/poop.txtanim
|
139
|
+
- data/sleep.txtanim
|
140
|
+
- data/teen/001_baloop.txtanim
|
141
|
+
- data/teen/002_roboty.txtanim
|
130
142
|
- lib/petli.rb
|
131
|
-
- lib/petli/animator.rb
|
132
143
|
- lib/petli/pet.rb
|
133
|
-
- lib/petli/
|
144
|
+
- lib/petli/pet/animation.rb
|
145
|
+
- lib/petli/pet/death.rb
|
146
|
+
- lib/petli/pet/food.rb
|
147
|
+
- lib/petli/pet/happy.rb
|
134
148
|
- lib/petli/stages.rb
|
135
149
|
- lib/petli/stages/base.rb
|
136
150
|
- lib/petli/stages/dice.rb
|
@@ -142,6 +156,7 @@ files:
|
|
142
156
|
- lib/petli/watch.rb
|
143
157
|
- lib/tatty.rb
|
144
158
|
- lib/tatty/anim.rb
|
159
|
+
- lib/tatty/atlas.rb
|
145
160
|
- lib/tatty/db.rb
|
146
161
|
- lib/tatty/stage.rb
|
147
162
|
- petli.gemspec
|
@@ -170,8 +185,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
185
|
- !ruby/object:Gem::Version
|
171
186
|
version: '0'
|
172
187
|
requirements: []
|
173
|
-
rubygems_version: 3.
|
174
|
-
signing_key:
|
188
|
+
rubygems_version: 3.2.3
|
189
|
+
signing_key:
|
175
190
|
specification_version: 4
|
176
191
|
summary: A little pet in your console
|
177
192
|
test_files: []
|
193
|
+
...
|
data/data/character.json
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"eyes": {
|
3
|
-
"default": ["O"],
|
4
|
-
"mezmerized": ["◉", "✧", "☯"],
|
5
|
-
"great": ["^", "O"],
|
6
|
-
"happy": ["O", "o"],
|
7
|
-
"tired": ["ළ", "ತ"],
|
8
|
-
"annoyed": ["⊜", "ಠ"],
|
9
|
-
"angry": ["ಠ"],
|
10
|
-
"embarassed": ["ಥ"],
|
11
|
-
"eating": ["O", ["ᗒ", "ᗕ"]],
|
12
|
-
"sick": [["⨴","⨵"],"ꔸ"]
|
13
|
-
},
|
14
|
-
"mouth": {
|
15
|
-
"default": ["_", "."],
|
16
|
-
"mezmerized": ["ᴥ", "O"],
|
17
|
-
"great": ["▽", "‿"],
|
18
|
-
"happy": ["o", "_"],
|
19
|
-
"tired": ["-", "."],
|
20
|
-
"annoyed": ["_", "-"],
|
21
|
-
"angry": ["益", "෴"],
|
22
|
-
"embarassed": ["◠", "-"],
|
23
|
-
"eating": ["▽", "‿"],
|
24
|
-
"sick": ["▱","﹃"]
|
25
|
-
},
|
26
|
-
"arms": {
|
27
|
-
"default": [["ᕠ", "ᕤ"], ["ᕦ", "ᕡ"]],
|
28
|
-
"plain": ["_", "~"],
|
29
|
-
"tired": ["_", "~"],
|
30
|
-
"embarassed": [["乁","ㄏ"], "_"],
|
31
|
-
"eating": [["\\", "/"], "_"],
|
32
|
-
"sick": ["_", "~"]
|
33
|
-
},
|
34
|
-
"head": {
|
35
|
-
"default": [["(", ")"]]
|
36
|
-
},
|
37
|
-
"bread": "ʕ=ʔ",
|
38
|
-
"candy": "▷☯◁",
|
39
|
-
"medicine": "◖◻◗"
|
40
|
-
}
|
data/data/face_ref
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
☠⚕
|
2
|
-
(o . o)
|
3
|
-
(o _ o)
|
4
|
-
(o _ O)
|
5
|
-
(O _ O)
|
6
|
-
(* ^ *)
|
7
|
-
(O _ o)
|
8
|
-
(ʘ _ ʘ)
|
9
|
-
(u _ u)
|
10
|
-
(^ _ ^)
|
11
|
-
(ಠ _ ಠ)
|
12
|
-
(^ o ^)
|
13
|
-
(◉ ᴥ ◉)
|
14
|
-
(o O o)
|
15
|
-
(o - o)
|
16
|
-
(- _ -)
|
17
|
-
(T _ T)
|
18
|
-
(ಥ _ ಥ)
|
19
|
-
(ಠ 益ಠ)
|
20
|
-
(ಠ ෴ ಠ)
|
21
|
-
(ᴗ □ ᴗ)
|
22
|
-
☆゚☆゚☆゚☆゚
|
23
|
-
(o ‿ o)
|
24
|
-
(ᗒ o ᗕ)
|
25
|
-
(⇀ - ↼)
|
26
|
-
(⨴ _ ⨵)
|
27
|
-
(ꔸ _ ꔸ)
|
28
|
-
(ළ _ ළ) # tired
|
29
|
-
(ತ _ ತ)
|
30
|
-
(⊜ _ ⊜)
|
31
|
-
(✧ _ ✧)
|
32
|
-
(☯ _ ☯)
|
33
|
-
|
34
|
-
\(⇀ O ↼)/ ʕ=ʔ
|
35
|
-
_(O _ O)_ =ʔ
|
36
|
-
\(⇀ O ↼)/ =ʔ
|
37
|
-
_(O _ O)_ ʔ
|
38
|
-
\(⇀ O ↼)/ ʔ
|
39
|
-
_(O _ O)_
|
40
|
-
(◉ ᴥ ◉)
|
41
|
-
(o O o)
|
42
|
-
|
43
|
-
ξꔸ ꔸ)
|
44
|
-
|
45
|
-
☛(O _ O)☛
|
46
|
-
☚(O _ O)☚
|
47
|
-
乁(O _ O)ㄏ
|
48
|
-
_(O _ O)_
|
49
|
-
ᕠ(O _ O)ᕤ
|
50
|
-
ᕦ(O _ O)ᕡ
|
51
|
-
\(O _ O)/
|
52
|
-
/(O _ O)\
|
53
|
-
|
54
|
-
ߍ೧
|
55
|
-
༼ºل͟º༽
|
56
|
-
|
57
|
-
poop friend
|
58
|
-
ı ┐ ┌ ┌ ı ı ı ┌ ┐ ┐ ı ı
|
59
|
-
༼ᵔ◡ᵔ༽ ༼ಠ益ಠ༽ ༼ᵔ◡ᵔ༽ ༼ಠ益ಠ༽
|
60
|
-
|
61
|
-
⚀ ⚁ ⚂ ⚃ ⚄ ⚅
|
62
|
-
|
63
|
-
_
|
64
|
-
(O O)
|
65
|
-
|-|
|
66
|
-
|
67
|
-
☠
|
68
|
-
|
69
|
-
┌───┐
|
70
|
-
│ ☠ │
|
71
|
-
│ │
|
72
|
-
```````
|
73
|
-
|
data/lib/petli/animator.rb
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
module Petli
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
class Animator
|
5
|
-
ANIMATIONS = {
|
6
|
-
egg: [" _\n / \\\n \\_/", " _\n((/ \\\n \\_/))", " _\n / \\))\n((\\_/"]*5,
|
7
|
-
egg_crack: [" _\n/ \\\n\\_‚/"," _\n/ \\\n\\_¡/"," _\n/ \\\n\\_¦/"," _\n/ ¡\\\n\\_ϟ/"," _\n/ ¦\\\n\\_ϟ/"," _\n/ ϟ\\\n\\_ϟ/","\n/ ϟ\\\n\\_ϟ/"," ☁\n/ ϟ\\\n\\_ϟ/"],
|
8
|
-
stand: ["\n\nahe m eha\n", "\n\nahe m eha\n"],
|
9
|
-
left: ["\n\nahe m e ha\n", "\n\nahe m e ha\n"],
|
10
|
-
right: ["\n\nah e m eha\n", "\n\nah e m eha\n"],
|
11
|
-
item: ["\n\nahe m eha fff\n", "\n\nahe m eha fff\n", "\n\nahe m eha fff\n", "\n\nahe m eha fff\n"],
|
12
|
-
eat: ["\n\nahe m eha fff\n", "\n\nahe m eha ff\n", "\n\nahe m eha ff\n", "\n\nahe m eha f\n", "\n\nahe m eha f\n", "\n\nahe m eha\n"],
|
13
|
-
walk: ["\n\n ahe m eha\n", "\n\nahe m e ha\n", "\n\nahe m eha\n", "\n\nah e m eha\n"],
|
14
|
-
hop: ["\n\n ahe m eha\n", "\nahe m e ha\n\n", "\n\nahe m e ha\n", "\n\nahe m eha\n", "\nah e m eha\n\n", "\n\nah e m eha\n"],
|
15
|
-
death: [" ┌───┐ \n │ ☠ │ \n │ │ \n ```````", " ┌───┐ \n │ ☠ │ \n │ │ \n '''''''"],
|
16
|
-
}
|
17
|
-
|
18
|
-
attr_writer :mood
|
19
|
-
attr_reader :action
|
20
|
-
|
21
|
-
def initialize(hatching:, mood:, action: :walk)
|
22
|
-
@frame = 0
|
23
|
-
@food = :bread
|
24
|
-
@mood = mood
|
25
|
-
@action = action
|
26
|
-
if hatching
|
27
|
-
@mood_stack = [:mezmerized, :mezmerized, :mezmerized, :mezmerized]
|
28
|
-
@action_stack = [:egg, :egg_crack, :stand, :stand]
|
29
|
-
else
|
30
|
-
@mood_stack = []
|
31
|
-
@action_stack = []
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def step
|
36
|
-
add_frame
|
37
|
-
leftarm, rightarm = getit(:arms, 2)
|
38
|
-
lefteye, righteye = getit(:eyes, 2)
|
39
|
-
mouth = getit(:mouth)
|
40
|
-
lefthead, righthead = getit(:head, 2)
|
41
|
-
[leftarm,lefthead,lefteye,mouth,righteye,righthead,rightarm]
|
42
|
-
|
43
|
-
food_peices = food.split('')
|
44
|
-
|
45
|
-
ANIMATIONS[action][frame]
|
46
|
-
.sub('a', leftarm.to_s).sub('a', rightarm.to_s)
|
47
|
-
.sub('h', lefthead).sub('h', righthead)
|
48
|
-
.sub('e', lefteye).sub('e', righteye)
|
49
|
-
.sub('m', mouth)
|
50
|
-
.reverse
|
51
|
-
.sub('f', food_peices[2]).sub('f', food_peices[1]).sub('f', food_peices[0])
|
52
|
-
.reverse
|
53
|
-
end
|
54
|
-
|
55
|
-
def eat(food: :bread, &block)
|
56
|
-
@busy = true
|
57
|
-
@frame = 0
|
58
|
-
@food = food
|
59
|
-
@action_stack = [:item, :eat, :stand, :stand, :stand, :stand]
|
60
|
-
@mood_stack = [:mezmerized, :eating, :eating, :mezmerized, :mezmerized]
|
61
|
-
@on_complete = block
|
62
|
-
end
|
63
|
-
|
64
|
-
def celebrate
|
65
|
-
@action_stack = [:stand, :stand, :stand, :stand]
|
66
|
-
@mood_stack = [:mezmerized, :mezmerized, :mezmerized, :mezmerized]
|
67
|
-
@frame = 0
|
68
|
-
end
|
69
|
-
|
70
|
-
def embarass
|
71
|
-
@action_stack = [:stand, :stand, :stand, :stand]
|
72
|
-
@mood_stack = [:embarassed, :embarassed, :embarassed, :embarassed]
|
73
|
-
@frame = 0
|
74
|
-
end
|
75
|
-
|
76
|
-
def busy?
|
77
|
-
@busy
|
78
|
-
end
|
79
|
-
|
80
|
-
def action=(act)
|
81
|
-
@action = act
|
82
|
-
@frame = 0
|
83
|
-
end
|
84
|
-
|
85
|
-
def action
|
86
|
-
@action_stack.count > 0 ? @action_stack[0] : @action
|
87
|
-
end
|
88
|
-
|
89
|
-
def mood
|
90
|
-
@mood_stack.count > 0 ? @mood_stack[0] : @mood
|
91
|
-
end
|
92
|
-
|
93
|
-
private
|
94
|
-
|
95
|
-
def add_frame
|
96
|
-
frame_count = ANIMATIONS[action].count
|
97
|
-
@frame += 1
|
98
|
-
if frame == frame_count
|
99
|
-
@frame = 0
|
100
|
-
@action_stack.shift if @action_stack.count > 0
|
101
|
-
@mood_stack.shift if @mood_stack.count > 0
|
102
|
-
if @action_stack.count == 0 && @mood_stack.count == 0
|
103
|
-
@busy = false
|
104
|
-
@on_complete.call unless @on_complete.nil?
|
105
|
-
@on_complete = nil
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def food
|
111
|
-
data[@food]
|
112
|
-
end
|
113
|
-
|
114
|
-
def frame # to control framerate
|
115
|
-
(@frame/3).ceil
|
116
|
-
end
|
117
|
-
|
118
|
-
def getit(part, vals=1)
|
119
|
-
mood_part = data[part][mood] || data[part][:default]
|
120
|
-
part_frame = frame % mood_part.count
|
121
|
-
result = mood_part[part_frame]
|
122
|
-
if vals == 2 && result.is_a?(String)
|
123
|
-
[result, result]
|
124
|
-
else
|
125
|
-
result
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
def data
|
130
|
-
@data ||= JSON.parse(
|
131
|
-
File.read(File.expand_path('../../data/character.json', __dir__)),
|
132
|
-
{:symbolize_names => true}
|
133
|
-
)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|