minigl 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -15
- data/lib/minigl/game_object.rb +4 -4
- data/lib/minigl/movement.rb +36 -21
- metadata +21 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba735bed35dcb47ec7023231533a5f02abde38fe
|
4
|
+
data.tar.gz: 3fa15e9e6eed7895295f3e610a7319e8094276e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e95d7e26cb0b7d1594a874f62de328c34364186bc30615091d811386e40143bcd47329b3dcb831faf475ef5f45567f975294b52505745f9a006302c1ce2e1fd
|
7
|
+
data.tar.gz: 38ea70665e7bf11dc36dc1c1ba4bc21808280382fc9a04a1510946cf3b2fc01cac88a8810f328046533d7f8fdc636cd90897fe5aaeb4ebd60d0177a99bb028ec
|
data/README.md
CHANGED
@@ -21,22 +21,16 @@ compiling extensions. Visit
|
|
21
21
|
[this page](https://github.com/jlnr/gosu/wiki/Getting-Started-on-Linux) for
|
22
22
|
details.
|
23
23
|
|
24
|
-
After installing the
|
24
|
+
After installing the Gosu dependencies, you can just `gem install minigl`.
|
25
25
|
|
26
|
-
|
26
|
+
## Documentation
|
27
27
|
|
28
|
-
* The
|
29
|
-
|
30
|
-
|
31
|
-
* The library is 100% RDoc-documented.
|
32
|
-
* An auxiliary, tutorial-like documentation is under construction
|
33
|
-
[here](https://github.com/victords/minigl/wiki/How-To).
|
28
|
+
* The library is 100% RDoc-documented [here](http://www.rubydoc.info/gems/minigl/2.0.5).
|
29
|
+
* The [wiki](https://github.com/victords/minigl/wiki) is a work in progress with tutorials and examples.
|
30
|
+
* Test package and examples aren't complete!
|
34
31
|
|
35
|
-
## Version 2.0.
|
32
|
+
## Version 2.0.6
|
36
33
|
|
37
|
-
*
|
38
|
-
* Flexibilized the `
|
39
|
-
|
40
|
-
* Added `on_changed` event for the `DropDownList` control.
|
41
|
-
* Adjusted `draw` in `Sprite` and `GameObject` so that, when drawing objects
|
42
|
-
rotated or not rotated, the origin of the image is consistent.
|
34
|
+
* Fixed the `draw` method of `GameObject` when using both scale and flip.
|
35
|
+
* Flexibilized the `move_carrying` method from `Movement` with the possibility
|
36
|
+
of specifying a forces vector instead of an aim and fixed speed.
|
data/lib/minigl/game_object.rb
CHANGED
@@ -215,13 +215,13 @@ module MiniGL
|
|
215
215
|
|
216
216
|
color = (alpha << 24) | color
|
217
217
|
if angle
|
218
|
-
@img[@img_index].draw_rot @x + (flip == :horiz ? -1 : 1) * @img_gap.x - (map ? map.cam.x : 0) + @
|
219
|
-
@y + (flip == :vert ? -1 : 1) * @img_gap.y - (map ? map.cam.y : 0) + @
|
218
|
+
@img[@img_index].draw_rot @x + (flip == :horiz ? -1 : 1) * @img_gap.x - (map ? map.cam.x : 0) + @w * 0.5,
|
219
|
+
@y + (flip == :vert ? -1 : 1) * @img_gap.y - (map ? map.cam.y : 0) + @h * 0.5,
|
220
220
|
z_index, angle, 0.5, 0.5, (flip == :horiz ? -scale_x : scale_x),
|
221
221
|
(flip == :vert ? -scale_y : scale_y), color
|
222
222
|
else
|
223
|
-
@img[@img_index].draw @x + (flip == :horiz ? -1 : 1) * @img_gap.x - (map ? map.cam.x : 0) + (flip == :horiz ?
|
224
|
-
@y + (flip == :vert ? -1 : 1) * @img_gap.y - (map ? map.cam.y : 0) + (flip == :vert ?
|
223
|
+
@img[@img_index].draw @x + (flip == :horiz ? -1 : 1) * @img_gap.x - (map ? map.cam.x : 0) + (flip == :horiz ? @w : 0),
|
224
|
+
@y + (flip == :vert ? -1 : 1) * @img_gap.y - (map ? map.cam.y : 0) + (flip == :vert ? @h : 0),
|
225
225
|
z_index, (flip == :horiz ? -scale_x : scale_x),
|
226
226
|
(flip == :vert ? -scale_y : scale_y), color
|
227
227
|
end
|
data/lib/minigl/movement.rb
CHANGED
@@ -342,12 +342,14 @@ module MiniGL
|
|
342
342
|
end
|
343
343
|
|
344
344
|
# Moves this object as an elevator (i.e., potentially carrying other
|
345
|
-
# objects) towards a given point.
|
345
|
+
# objects) with the specified forces or towards a given point.
|
346
346
|
#
|
347
347
|
# Parameters:
|
348
|
-
# [
|
349
|
-
#
|
350
|
-
#
|
348
|
+
# [arg] A Vector specifying either the forces acting on this object or a
|
349
|
+
# point towards the object should move.
|
350
|
+
# [speed] If the first argument is a forces vector, then this should be
|
351
|
+
# +nil+. If it is a point, then this is the constant speed at which
|
352
|
+
# the object will move (provided as a scalar, not a vector).
|
351
353
|
# [obstacles] An array of obstacles to be considered in the collision
|
352
354
|
# checking, and carried along when colliding from above.
|
353
355
|
# Obstacles must be instances of Block (or derived classes),
|
@@ -358,17 +360,26 @@ module MiniGL
|
|
358
360
|
# of the objects being carried.
|
359
361
|
# [obst_ramps] Ramps to consider when moving objects from the +obstacles+
|
360
362
|
# array, as described for +obst_obstacles+.
|
361
|
-
def move_carrying(
|
362
|
-
|
363
|
-
|
363
|
+
def move_carrying(arg, speed, obstacles, obst_obstacles, obst_ramps)
|
364
|
+
if speed
|
365
|
+
x_d = arg.x - @x; y_d = arg.y - @y
|
366
|
+
distance = Math.sqrt(x_d**2 + y_d**2)
|
364
367
|
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
368
|
+
if distance == 0
|
369
|
+
@speed.x = @speed.y = 0
|
370
|
+
return
|
371
|
+
end
|
369
372
|
|
370
|
-
|
371
|
-
|
373
|
+
@speed.x = 1.0 * x_d * speed / distance
|
374
|
+
@speed.y = 1.0 * y_d * speed / distance
|
375
|
+
else
|
376
|
+
arg += G.gravity
|
377
|
+
@speed.x += arg.x / @mass; @speed.y += arg.y / @mass
|
378
|
+
@speed.x = 0 if @speed.x.abs < G.min_speed.x
|
379
|
+
@speed.y = 0 if @speed.y.abs < G.min_speed.y
|
380
|
+
@speed.x = (@speed.x <=> 0) * @max_speed.x if @speed.x.abs > @max_speed.x
|
381
|
+
@speed.y = (@speed.y <=> 0) * @max_speed.y if @speed.y.abs > @max_speed.y
|
382
|
+
end
|
372
383
|
|
373
384
|
x_aim = @x + @speed.x; y_aim = @y + @speed.y
|
374
385
|
passengers = []
|
@@ -382,15 +393,19 @@ module MiniGL
|
|
382
393
|
end
|
383
394
|
|
384
395
|
prev_x = @x; prev_y = @y
|
385
|
-
if
|
386
|
-
@x
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
@y
|
396
|
+
if speed
|
397
|
+
if @speed.x > 0 && x_aim >= arg.x || @speed.x < 0 && x_aim <= arg.x
|
398
|
+
@x = arg.x; @speed.x = 0
|
399
|
+
else
|
400
|
+
@x = x_aim
|
401
|
+
end
|
402
|
+
if @speed.y > 0 && y_aim >= arg.y || @speed.y < 0 && y_aim <= arg.y
|
403
|
+
@y = arg.y; @speed.y = 0
|
404
|
+
else
|
405
|
+
@y = y_aim
|
406
|
+
end
|
392
407
|
else
|
393
|
-
@y = y_aim
|
408
|
+
@x = x_aim; @y = y_aim
|
394
409
|
end
|
395
410
|
|
396
411
|
forces = Vector.new @x - prev_x, @y - prev_y
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minigl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor David Santos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gosu
|
@@ -90,38 +90,38 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.4.
|
93
|
+
rubygems_version: 2.4.8
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: MiniGL
|
97
97
|
test_files:
|
98
|
-
- test/
|
99
|
-
- test/movement_tests.rb
|
100
|
-
- test/iso_game.rb
|
98
|
+
- test/mov_game.rb
|
101
99
|
- test/game_object_tests.rb
|
102
100
|
- test/game.rb
|
101
|
+
- test/iso_game.rb
|
103
102
|
- test/vector_tests.rb
|
104
|
-
- test/
|
103
|
+
- test/map_tests.rb
|
104
|
+
- test/movement_tests.rb
|
105
105
|
- test/res_tests.rb
|
106
106
|
- test/test.png
|
107
|
-
- test/data/
|
108
|
-
- test/data/
|
109
|
-
- test/data/
|
107
|
+
- test/data/tileset/tileset1.png
|
108
|
+
- test/data/font/font1.ttf
|
109
|
+
- test/data/sound/1.wav
|
110
|
+
- test/data/img/check.png
|
110
111
|
- test/data/img/tile2.png
|
111
|
-
- test/data/img/
|
112
|
+
- test/data/img/image.png
|
113
|
+
- test/data/img/tile1.png
|
112
114
|
- test/data/img/tile1b.png
|
115
|
+
- test/data/img/barbg.svg
|
116
|
+
- test/data/img/text.png
|
113
117
|
- test/data/img/btn.png
|
118
|
+
- test/data/img/barfg.svg
|
119
|
+
- test/data/img/square.png
|
120
|
+
- test/data/img/tile1.svg
|
121
|
+
- test/data/img/barbg.png
|
122
|
+
- test/data/img/img1.png
|
114
123
|
- test/data/img/barfg.png
|
115
|
-
- test/data/img/square.svg
|
116
124
|
- test/data/img/tile2.svg
|
117
|
-
- test/data/img/
|
125
|
+
- test/data/img/square.svg
|
118
126
|
- test/data/img/tile2b.png
|
119
|
-
- test/data/img/barbg.svg
|
120
|
-
- test/data/img/barbg.png
|
121
|
-
- test/data/img/tile1.png
|
122
|
-
- test/data/img/text.png
|
123
|
-
- test/data/img/tile1.svg
|
124
|
-
- test/data/font/font1.ttf
|
125
|
-
- test/data/tileset/tileset1.png
|
126
|
-
- test/data/sound/1.wav
|
127
127
|
- test/data/img/sub/image.png
|