Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tweaked velocities for asteroids to change depending on their size.

Added score values for different sized asteroids (not implemented yet!)
Tweaked bullet velocities, and number of bullets spawned.
  • Loading branch information...
commit 78d9106ec70ae93d3d83bd945e70128eb973e724 1 parent 78fd95e
@robc authored
Showing with 18 additions and 10 deletions.
  1. +6 −1 asteroid_manager.rb
  2. +12 −9 game_constants.rb
View
7 asteroid_manager.rb
@@ -19,6 +19,11 @@ def initialize(pool_size, large_asteroid_image, medium_asteroid_image, small_ast
@bounding_sphere_radius[:medium] = MediumAsteroidBoundingSphereRadius
@bounding_sphere_radius[:small] = SmallAsteroidBoundingSphereRadius
+ @asteroid_velocities = Hash.new()
+ @asteroid_velocities[:large] = LargeAsteroidForwardVelocity
+ @asteroid_velocities[:medium] = MediumAsteroidForwardVelocity
+ @asteroid_velocities[:small] = SmallAsteroidForwardVelocity
+
@active_asteroids = Array.new()
@asteroid_pool = Array.new(pool_size) do |asteroid|
asteroid = Asteroid.new(:large, large_asteroid_image, @bounding_sphere_radius[:large])
@@ -129,7 +134,7 @@ def spawn_asteroid(size)
asteroid.bounding_sphere_radius = @bounding_sphere_radius[size]
asteroid.object_image = @asteroid_images[size]
asteroid.angle = rand(360)
- asteroid.set_forward_velocity(AsteroidForwardVelocity)
+ asteroid.set_forward_velocity(@asteroid_velocities[size])
# Do we want to spawn on the side, or on the top?
spawn_horizontal = get_random_boolean
View
21 game_constants.rb
@@ -2,7 +2,7 @@ module GameConstants
ScreenWidth = 1024
ScreenHeight = 768
BoundsBufferSize = 50
- BulletFireDelay = 40
+ BulletFireDelay = 20
LargeAsteroidBoundingSphereRadius = 56
MediumAsteroidBoundingSphereRadius = 28
@@ -17,20 +17,23 @@ module GameConstants
HyperspaceTime = 120
BulletLifeCycle = 240
- BulletVelocity = 300
- NumberOfBullets = 3
+ BulletVelocity = 400
+ NumberOfBullets = 6
- PlayerRespawnTime = 60
- NewWaveDelay = 90
+ PlayerRespawnTime = 180
+ NewWaveDelay = 120
MinAsteroidsToSpawn = 4
MaxAsteroidsInPool = 50
- AsteroidForwardVelocity = 30
- AsteroidScore = 500
+ AsteroidScore = 75
- SmallAsteroidForwardVelocity = 40
- MediumAsteroidForwardVelocity = 25
LargeAsteroidForwardVelocity = 10
+ MediumAsteroidForwardVelocity = 30
+ SmallAsteroidForwardVelocity = 50
+
+ LargeAsteroidScore = 20
+ MediumAsteroidScore = 50
+ SmallAsteroidScore = 100
AsteroidRotationSpeed = 0.25
end
Please sign in to comment.
Something went wrong with that request. Please try again.