minigl 2.2.7 → 2.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/minigl/movement.rb +24 -8
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba385a96959c1555b3e5320944b789b433bc56f18cd18db29980cf7634f80982
4
- data.tar.gz: 773e3ef0d6936a63966f0ab8eceda898ffe10102ae593f84fc6785a2567d1cbf
3
+ metadata.gz: 2b4770937913304de29f2696a7d7a0e75fc468185579efa3b421a4abe46253e8
4
+ data.tar.gz: 84c72db0c03039a09767d39138b681201a2d5028e3ef278b1096b1c89b9e472d
5
5
  SHA512:
6
- metadata.gz: c943b0790907572909f6d46d507a5fcee1c405c0bbc1690e13a994a7629ecfc12b55ec81a12d671515031b766c6da5728ccaada66e0c2586a9a52d6f5a05aea6
7
- data.tar.gz: e6a3a4916293489018441f9ed709e303fdce3e89793a8a8bfbd6c94d66bea40dac62015063e02e33585c1b07c4d404b3abc6b4e88fad063a9ca7b9dc2153c99d
6
+ metadata.gz: 36242a7d0fd3c52df939408e744bc01139b2b34b7f9b3f86e6e64989778a0eb51b48fa7eb56ebf74c8a0e59a6781cadf186e4cd0719002afa6abf4c2f14998c3
7
+ data.tar.gz: b0706f37c19fd9e48bf43fc0921b9c9991e355044c5e99374df4821a5be18b5abda87c73375d1cdc84a3bd964a28fbc7e0c176c2e78167b50ebcd5ae015a2137
data/README.md CHANGED
@@ -29,9 +29,9 @@ After installing the Gosu dependencies, you can just `gem install minigl`.
29
29
  * The [wiki](https://github.com/victords/minigl/wiki) is a work in progress with tutorials and examples.
30
30
  * Test package and examples aren't complete!
31
31
 
32
- ## Version 2.2.7
32
+ ## Version 2.2.8
33
33
 
34
- * Add support for gamepad/joystick buttons in the `KB` class.
34
+ * Add `stop_time` parameter to the `cycle` method of `Movement` (included in `GameObject`).
35
35
 
36
36
  ## Contributing
37
37
 
@@ -504,16 +504,32 @@ module MiniGL
504
504
  # of the objects being carried.
505
505
  # [obst_ramps] Ramps to consider when moving objects from the +obstacles+
506
506
  # array, as described for +obst_obstacles+.
507
- def cycle(points, speed, obstacles = nil, obst_obstacles = nil, obst_ramps = nil)
508
- @cur_point = 0 if @cur_point.nil?
509
- if obstacles
510
- move_carrying points[@cur_point], speed, obstacles, obst_obstacles, obst_ramps
511
- else
512
- move_free points[@cur_point], speed
507
+ # [stop_time] Optional stop time (in frames) when the object reaches each of
508
+ # the points.
509
+ def cycle(points, speed, obstacles = nil, obst_obstacles = nil, obst_ramps = nil, stop_time = 0)
510
+ unless @cycle_setup
511
+ @cur_point = 0 if @cur_point.nil?
512
+ if obstacles
513
+ move_carrying points[@cur_point], speed, obstacles, obst_obstacles, obst_ramps
514
+ else
515
+ move_free points[@cur_point], speed
516
+ end
513
517
  end
514
518
  if @speed.x == 0 and @speed.y == 0
515
- if @cur_point == points.length - 1; @cur_point = 0
516
- else; @cur_point += 1; end
519
+ unless @cycle_setup
520
+ @cycle_timer = 0
521
+ @cycle_setup = true
522
+ end
523
+ if @cycle_timer >= stop_time
524
+ if @cur_point == points.length - 1
525
+ @cur_point = 0
526
+ else
527
+ @cur_point += 1
528
+ end
529
+ @cycle_setup = false
530
+ else
531
+ @cycle_timer += 1
532
+ end
517
533
  end
518
534
  end
519
535
 
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.2.7
4
+ version: 2.2.8
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: 2020-04-10 00:00:00.000000000 Z
11
+ date: 2020-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gosu