aniruby 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 361fe4d0f4dddeca7090d35a7bb225440fd51c94c69d5b7ea0a0be8826437340
4
- data.tar.gz: afb5d871c301e09df8559cd66e2609c408e810f9f3d48e68adaf851569f19a4b
3
+ metadata.gz: 07c57ae1df17b975510ec7c10d3e92f5d3de577a3e59d90fa1237e3b25b9cb8a
4
+ data.tar.gz: f6e1cef73f7016f0c1438720b94250ca0be9f57ffc837241af09d7445a7dbc22
5
5
  SHA512:
6
- metadata.gz: 9a1d8d7b7c1fabdde8b84c68199463af199ed6bfdf7e5f7e7b684f5fc5a9abba315095655bb22904be5eb29c61877c4ae6f5f348a29971b2103e739506a6950f
7
- data.tar.gz: d79b9b2f63047cad421027880c40723472a22fcf4f13e0444a4da89cb99aab772fc8eff1d1cacabb6c38ce568dd6276651f6d9b1d5b9fbf10cb738d19320b454
6
+ metadata.gz: 7de44afd2d12a498a42ff63bd48ccfecce6a69ede7b22c0a8e4cf0df4b58898de45de19aec652c28dc84fadcfe9d525bc6677d1466b4cfd4c5cea60ab17f74f8
7
+ data.tar.gz: d6cc64703ade970bda443b91a15c400f510d102d8d6371dad2c559806f6e019b2150829d9fa004663e52c5141377f1d2436b4e81a94bcc778cda608869f3b781
data/CHANGELOG.md CHANGED
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.2.1 - 2023-09-07
11
+
12
+ ### Fixed
13
+
14
+ - **Important**: in v0.2.0 one of the notable changes is that the instance variable `current_frame` was changed to `position`, following that there was
15
+ the need to change every use of `@current_frame` to `@position`, however
16
+ since I wasn't thorough enough I forgot to do that in the `Animation#draw` and `Animation#draw_rot`
17
+ methods, effectively rendering them useless.
18
+ - **Important**: There was a error in `Animation#done?` too, where it'll return `false` always
19
+ independently of if the animation was finished, this was because I forgot to add a `return` in
20
+ the condition check for the `true`.
21
+ - `Animation#update` now resets the animation, instead of `Animation#draw`
22
+ or `Animation#draw_rot` (I know, that sounds unintuitive). This (I think) fixes a precision problem when drawing the last frame
23
+ of an animation, in the which it was drawn for less time than required.
24
+
25
+
10
26
  ## 0.2.0 - 2023-09-02
11
27
 
12
28
  This release brings mostly improvements and fixes, however there's not that much
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AniRuby
2
2
 
3
- ![Gem (including prereleases)](https://img.shields.io/gem/v/aniruby?style=flat-square&color=blue)
3
+ ![Gem (including prereleases)](https://img.shields.io/gem/v/aniruby?style=flat-square&logo=rubygems&logoColor=white&color=blue)
4
4
 
5
5
  Make sprite animations on Gosu simple and easy.
6
6
 
@@ -75,9 +75,13 @@ module AniRuby
75
75
  # Update the animation, advancing the frame counter. Note that this won't do
76
76
  # do anything if the animation is paused or has finished
77
77
  def update
78
- return if done? || paused?
78
+ return unless frame_expired? && !paused?
79
79
 
80
- @position += 1 if frame_expired?
80
+ if !done?
81
+ @position += 1
82
+ elsif done? && @loop
83
+ @position = 0
84
+ end
81
85
  end
82
86
 
83
87
  # Draw the animation
@@ -96,11 +100,9 @@ module AniRuby
96
100
  scale_y = 1,
97
101
  color = Gosu::Color::WHITE,
98
102
  mode = :default)
99
- frame = @frames[@current_frame]
103
+ frame = @frames[@position]
100
104
 
101
105
  frame.sprite.draw(x, y, z, scale_x, scale_y, color, mode)
102
-
103
- @position = 0 if @loop && done?
104
106
  end
105
107
 
106
108
  # Draw the animation rotated, with its rotational center at (x, y).
@@ -125,12 +127,9 @@ module AniRuby
125
127
  scale_y = 1,
126
128
  color = Gosu::Color::WHITE,
127
129
  mode = :default)
128
- frame = @frames[@current_frame]
130
+ frame = @frames[@position]
129
131
 
130
132
  frame.sprite.draw_rot(x, y, z, angle, center_x, center_y, scale_x, scale_y, color, mode)
131
-
132
- # Loop the animation
133
- @position = 0 if @loop && done?
134
133
  end
135
134
 
136
135
  # Pause the animation
@@ -172,7 +171,7 @@ module AniRuby
172
171
  # @return [Boolean]
173
172
  # @note This method will return true in intervals if the animation loops
174
173
  def done?
175
- true if @position == @frames.count - 1
174
+ return true if @position == @frames.count - 1
176
175
 
177
176
  false
178
177
  end
@@ -2,7 +2,7 @@
2
2
  module AniRuby
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- PATCH = 0
5
+ PATCH = 1
6
6
 
7
7
  # See https://semver.org/
8
8
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}".freeze
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aniruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chadow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-02 00:00:00.000000000 Z
11
+ date: 2023-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gosu