bricks_meet_balls 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: dc30d72016b6b37442e2d9f47007c413d86bd82d
4
- data.tar.gz: c036dfe4feceb8298a920c7eac307b8f1cce9f69
3
+ metadata.gz: 66706a65047376f0a85a62aed149e15f17608265
4
+ data.tar.gz: 76c2a71feb7c8f7259df3cbbf8157e1c3cbee0d2
5
5
  SHA512:
6
- metadata.gz: 678d5057c642c67f6b96aaad88925230dd786157881f517895de5a4982ed0b7b2605ae39a1d77698f37fee8fe4aac17a279773f621d0262bd6f77a35e82f9e02
7
- data.tar.gz: 1d1adb3c67df3c98983fdcbfe768482f120e48b0f153d45ecf5ff92e98eb08e4fe552916930997f9edb2ac49cbd09c8e17c2e2a591a3d51796029ac0d8640125
6
+ metadata.gz: 0691572b829556820dc0e44220ce8e5f81e2e73ad7d4446964a9f884907f4c5160b4ed5c4b7e9022594d0abdc82e3dc59f4da1ed538e17299edfcf82bab556a2
7
+ data.tar.gz: 77a05581f232059bf850be09d13ef1bbbad33f3b188314221c9a1e6f091b1b1f8699dc0b002c5ff6de55b94e2ba536d9ca29801360ba4375465b58134c881dd5
data/NEWS.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # NEWS
2
2
 
3
+ ## 0.0.3: 2014-03-27
4
+
5
+ ### Changes
6
+
7
+ * Improvements
8
+ * Support background image
9
+ * Support endless mode
10
+ * Improved angles of balls
11
+
3
12
  ## 0.0.2: 2014-03-25
4
13
 
5
14
  Support multiple images for bricks and balls!
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Bricks meet Balls
2
2
 
3
- A game template as Break the Bricks using Gosu and Ruby.
3
+ A game template as Break the Bricks using [Gosu][] and [Ruby][].
4
+
5
+ [Gosu]: http://www.libgosu.org/
6
+ [Ruby]: https://www.ruby-lang.org/
4
7
 
5
8
  ## Installation
6
9
 
@@ -26,6 +29,10 @@ Or install it yourself as:
26
29
 
27
30
  See examples/ directory.
28
31
 
32
+ ## License
33
+
34
+ MIT License. See LICENSE.txt for details.
35
+
29
36
  ## Contributing
30
37
 
31
38
  1. Fork it ( http://github.com/myokoym/bricks_meet_balls/fork )
@@ -39,6 +39,7 @@ height = 480
39
39
  num_of_rows = 10
40
40
  num_of_columns = 8
41
41
  num_of_balls = 29
42
+ endless = true
42
43
 
43
44
  base_dir = File.expand_path(File.dirname(__FILE__))
44
45
  ball_images = BALL_IMAGES.collect do |ball_image|
@@ -54,6 +55,9 @@ window = BricksMeetBalls::Window.new(width,
54
55
  num_of_columns,
55
56
  num_of_balls,
56
57
  ball_images,
57
- brick_images)
58
+ brick_images,
59
+ endless)
60
+
61
+ window.set_background_image(brick_images.first)
58
62
 
59
63
  window.show
@@ -4,6 +4,7 @@ require "bricks_meet_balls/brick"
4
4
  require "bricks_meet_balls/ball"
5
5
  require "bricks_meet_balls/bar"
6
6
  require "bricks_meet_balls/message"
7
+ require "bricks_meet_balls/util"
7
8
 
8
9
  module BricksMeetBalls
9
10
  end
@@ -12,7 +12,7 @@ module BricksMeetBalls
12
12
  @window = window
13
13
  @x = @y = 0.0
14
14
  @ball_radius = @window.height * 0.01
15
- @angle = 30 + (5.0 * [*1..10, *14..24].sample) - 90
15
+ @angle = ([*30..85, *95..150].sample) - 90
16
16
  @speed = @window.height * 0.005
17
17
  @moving = true
18
18
  if image_path
@@ -22,6 +22,10 @@ module BricksMeetBalls
22
22
  end
23
23
 
24
24
  def draw
25
+ draw_square(@window,
26
+ @x1, @y1,
27
+ @x2, @y2,
28
+ Gosu::Color::WHITE, ZOrder::Brick)
25
29
  draw_frame(@window,
26
30
  @x1, @y1,
27
31
  @x2, @y2,
@@ -1,3 +1,3 @@
1
1
  module BricksMeetBalls
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -12,7 +12,7 @@ module BricksMeetBalls
12
12
 
13
13
  def initialize(width=240, height=480,
14
14
  num_of_rows=2, num_of_columns=3, num_of_balls=1,
15
- ball_images=nil, brick_images=nil)
15
+ ball_images=nil, brick_images=nil, endless=false)
16
16
  super(width, height, false)
17
17
  self.caption = "Bricks meet Balls"
18
18
  @x1 = 0
@@ -25,8 +25,13 @@ module BricksMeetBalls
25
25
  @message = nil
26
26
  @ball_images = ball_images
27
27
  @brick_images = brick_images
28
- create_bricks(num_of_columns, num_of_rows)
29
- create_balls(num_of_balls)
28
+ @num_of_columns = num_of_columns
29
+ @num_of_rows = num_of_rows
30
+ @num_of_balls = num_of_balls
31
+ @endless = endless
32
+ create_bricks(@num_of_columns, @num_of_rows)
33
+ create_balls(@num_of_balls)
34
+ @background_image = nil
30
35
  end
31
36
 
32
37
  def update
@@ -63,10 +68,18 @@ module BricksMeetBalls
63
68
  end
64
69
 
65
70
  if @message.nil? && @balls.empty?
66
- @message = Message.new(self, "Game Over...")
71
+ if @endless
72
+ create_balls(@num_of_balls)
73
+ else
74
+ @message = Message.new(self, "Game Over...")
75
+ end
67
76
  end
68
77
  if @message.nil? && @bricks.empty?
69
- @message = Message.new(self, "Congratulations!")
78
+ if @endless
79
+ create_bricks(@num_of_columns, @num_of_rows)
80
+ else
81
+ @message = Message.new(self, "Congratulations!")
82
+ end
70
83
  end
71
84
  end
72
85
 
@@ -95,12 +108,22 @@ module BricksMeetBalls
95
108
  end
96
109
  end
97
110
 
111
+ def set_background_image(image_path)
112
+ @background_image = Gosu::Image.new(self, image_path, false)
113
+ end
114
+
98
115
  private
99
116
  def draw_area
100
117
  draw_square(self,
101
118
  0, 0,
102
119
  self.width, self.height,
103
120
  Gosu::Color::WHITE, ZOrder::Background)
121
+ return unless @background_image
122
+ @background_image.draw(0,
123
+ 0,
124
+ ZOrder::Background,
125
+ 1.0 * self.width / @background_image.width,
126
+ 0.5 * self.height / @background_image.height)
104
127
  end
105
128
 
106
129
  def create_bricks(num_of_columns, num_of_rows)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bricks_meet_balls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masafumi Yokoyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-25 00:00:00.000000000 Z
11
+ date: 2014-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gosu