Permalink
Browse files

fixes for newest chingu + cleanups

  • Loading branch information...
1 parent 187a67b commit 906278cd104c1af5abcc0ef278501c62e058ba24 @ippa ippa committed Dec 8, 2009
Showing with 16 additions and 54 deletions.
  1. +2 −0 .gitignore
  2. +4 −13 Main.rb
  3. +1 −1 build.bat
  4. +1 −0 gamerv.txt
  5. +1 −1 models/bullet.rb
  6. +1 −1 models/droid.rb
  7. +1 −1 models/intro_state.rb
  8. +1 −1 models/otto.rb
  9. +1 −1 models/player.rb
  10. +3 −35 models/playstate.rb
View
@@ -1,4 +1,6 @@
lib
+lib2
pkg
.gem
.git
+gamercv.txt
View
17 Main.rb
@@ -13,15 +13,6 @@
exit if defined?(Ocra)
-#
-# Monkeypatch some in wait for new chingu
-#
-module Chingu
- class Animation
- attr_accessor :frames, :delay, :step, :loop, :bounce, :step
- end
-end
-
class Game < Chingu::Window
attr_reader :factor, :font, :metalfont, :scores
@@ -30,10 +21,12 @@ def initialize(width = 800, height = 600, fullscreen = false, update_interval =
load_settings
+ $window.caption = "Berzerk! By deps & ippa. [ #gosu @ freenode IRC ]"
+
#
# TODO: Put user / password in a .gitignored file
#
- @scores = HighScoreList.load_remote(:game_id => 2,
+ @scores = OnlineHighScoreList.load(:game_id => 2,
:user => "berzerk",
:password => "droidlove",
:size => 10)
@@ -60,9 +53,7 @@ def initialize(width = 800, height = 600, fullscreen = false, update_interval =
# Normal font used elsewhere
@font = Font.new($window, default_font_name, 30)
-
- #push_game_state( HighScoreState )
-
+
push_game_state( IntroState )
end
View
@@ -1 +1 @@
-ocra Main.rb --no-autodll media\** sounds\** models\** lib\**\**\**
+ocra Main.rb --windows media\** sounds\** models\** lib\**\**
View
@@ -0,0 +1 @@
+berzerk:droidlove
View
@@ -3,7 +3,7 @@ class Bullet < Chingu::GameObject
@@red = Gosu::Color.new(255, 255, 0, 0)
@@white = Gosu::Color.new(255, 255, 255, 255)
- has_trait :collision_detection, :velocity
+ has_traits :collision_detection, :velocity
attr_reader :owner
def initialize( options )
View
@@ -4,7 +4,7 @@
# See Playstate#update for overall movement / collision logic
#
class Droid < Chingu::GameObject
- has_trait :timer, :velocity, :collision_detection
+ has_traits :timer, :velocity, :collision_detection
attr_reader :current_animation, :status
@@red = Gosu::Color.new(255, 255, 0, 0)
View
@@ -53,7 +53,7 @@ def initialize(options = {})
@drop_text << Text.create("& DEPS", :y => -700*4, :color => 0xFF00FF00, :stop_at => 200, :sound => "intro_2.wav", :falling => true)
@drop_text << Text.create("GAMING", :y => -800*4, :color => 0xFF0000FF, :stop_at => 300, :sound => "intro_3.wav", :falling => true)
end
-
+
def finalize
@sweep.stop if @sweep
end
View
@@ -11,7 +11,7 @@ def to_rad
class Otto < Chingu::GameObject
- has_trait :collision_detection
+ has_traits :collision_detection
def initialize( options )
super
View
@@ -1,6 +1,6 @@
class Player < Chingu::GameObject
- has_trait :collision_detection, :timer, :velocity
+ has_traits :collision_detection, :timer, :velocity
attr_reader :status, :die_sound
def initialize( options = {} )
View
@@ -250,17 +250,14 @@ def change_room( dir )
#show_message("#{bonus} points for clearing room")
end
$window.clear_speech
- droid_speech(msg)
+ droid_speech(msg)
- #game_objects.pause!
game_objects.each { |object| object.pause! if object.class != NotifyPopup }
end
def show_new_room
- game_objects.destroy_if { |gobj| gobj.class != NotifyPopup }
- #game_objects.destroy_all
-
+ game_objects.destroy_if { |gobj| gobj.class != NotifyPopup }
close_door = false
@@ -416,7 +413,7 @@ def set_otto_timer( num_droids )
end
def update
- $window.caption = "FPS:#{$window.fps} - dt:#{$window.milliseconds_since_last_tick} - objects:#{current_game_state.game_objects.size}"
+ #$window.caption = "FPS:#{$window.fps} - dt:#{$window.milliseconds_since_last_tick} - objects:#{current_game_state.game_objects.size}"
@score_counter += 5 if @score_counter < @score
@@ -450,9 +447,6 @@ def update
Otto.create( :x => @entry_x, :y => @entry_y )
#puts "Otto spawned"
end
-
- #return if @scroll # Don't
-
# Change room if player walked outside map
if @player and !@scroll
@@ -472,7 +466,6 @@ def update
if @pop_at
if Time.now >= @pop_at
$last_score = @score # TODO: check if this is high enough to be added on highscore list
- #pop_game_state( :setup => false )
pop_game_state( :setup => false )
push_game_state( GameOver )
end
@@ -485,8 +478,6 @@ def update
@lives -= 1
#puts "Player lives left: #{@lives}"
if @lives != 0
- #puts "Player is alive again"
- #create_player
show_new_room
else
@pop_at = Time.now + 3
@@ -519,33 +510,10 @@ def update
@typed_timer = 50
# media/texasled.ttf does not work on OSX
- #@message_img = Gosu::Image.from_text($window,@current_message,default_font_name(),50)
@message_remove_pos = -@current_message.length*32
end
end
-
- # if @player
- # #
- # # Let's have some droids walking towards the player
- # # The more droids the lazier
- # #
- # if rand(Droid.size * 10) == 0
- # # Fins first scanning robot and have it walk!
- # scanning_droids = Droid.all.select { |droid| droid.current_animation == :scan }
- # if (droid = scanning_droids.first)
- # droid.walk_towards(@player.x, @player.y)
- # end
- # end
- # end
-
- #Bullet.each_bounding_box_collision([Droid, Player]) do |bullet, target|
- # next if bullet.owner == target
- # bullet.on_collision
- # target.on_collision
- #end
-
-
end
def draw

0 comments on commit 906278c

Please sign in to comment.