Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added comments to samples. maze game pauses when level is complete.

  • Loading branch information...
commit 8baaead8bd70358585abc33537be63c5b09cb265 1 parent 34ca62b
@jwoertink authored
View
13 lib/maze.rb
@@ -38,7 +38,7 @@
class Maze < SimpleApplication
include ActionListener
- field_accessor :flyCam
+ field_accessor :flyCam, :paused
field_reader :cam, :settings
attr_accessor :playtime, :playing, :bullet_app_state, :player, :mark, :shootables, :gun_sound, :ambient_noise
@@ -205,11 +205,7 @@ def setup_keys!
input_manager.add_mapping("Up", KeyTrigger.new(KeyInput::KEY_W))
input_manager.add_mapping("Down", KeyTrigger.new(KeyInput::KEY_S))
input_manager.add_mapping("Shoot", KeyTrigger.new(KeyInput::KEY_SPACE), MouseButtonTrigger.new(MouseInput::BUTTON_LEFT))
- input_manager.add_listener(ControllerAction.new(self), "Left")
- input_manager.add_listener(ControllerAction.new(self), "Right")
- input_manager.add_listener(ControllerAction.new(self), "Up")
- input_manager.add_listener(ControllerAction.new(self), "Down")
- input_manager.add_listener(ControllerAction.new(self), "Shoot")
+ input_manager.add_listener(ControllerAction.new(self), ["Left", "Right", "Up", "Down", "Shoot"].to_java(:string))
end
def setup_text!
@@ -223,6 +219,7 @@ def setup_text!
@time_text = BitmapText.new(gui_font, false)
@time_text.size = 20
+ @time_text.color = ColorRGBA::Blue
@time_text.text = "PLAY TIME:"
@time_text.set_local_translation(50, 50, 0)
gui_node.attach_child(@time_text)
@@ -254,11 +251,13 @@ def simpleUpdate(tpf)
@walk_direction.add_local(cam_dir.negate) if @down
player.walk_direction = @walk_direction
cam.location = player.physics_location
- if cam.location.x > (@floor[:width] - 10) && cam.location.z > (@floor[:height] - 10) && playing?
+ if cam.location.x > (@floor[:width]) && cam.location.z > (@floor[:height] - 20) && playing?
puts "finish"
self.playing = false
finish_time = Time.now - playtime
+ # finish_time != (@counter / 1000)
@time_text.text = "FINISH TIME: #{finish_time.ceil} seconds"
+ self.paused = true #This might lock up the game..
end
end
View
5 lib/sample10.rb
@@ -1,3 +1,8 @@
+=begin
+ This is the sound sample. You should hear ambient background noise.
+ Clicking left mouse button will cause a gunshot to fire.
+=end
+
java_import "com.jme3.app.SimpleApplication"
java_import "com.jme3.audio.AudioNode"
java_import "com.jme3.input.controls.ActionListener"
View
5 lib/sample5.rb
@@ -1,3 +1,8 @@
+=begin
+ This sample shows how an alpha channel can work with a PNG. You should see 2 cubes,
+ a sphere with a directional light, and a textured wall that's partially see-through
+=end
+
java_import "com.jme3.app.SimpleApplication"
java_import "com.jme3.light.DirectionalLight"
java_import "com.jme3.material.Material"
View
5 lib/sample6.rb
@@ -1,3 +1,8 @@
+=begin
+ This example takes a model and shows a walking animation. You sould see the Oto Golem.
+ Press spacebar to make him walk
+=end
+
java_import "com.jme3.animation.AnimChannel"
java_import "com.jme3.animation.AnimControl"
java_import "com.jme3.animation.AnimEventListener"
View
5 lib/sample7.rb
@@ -1,3 +1,8 @@
+=begin
+ There are several blocks, and the golem. Press spacebar, or left mouse click to shoot them.
+ Watch the console to see which one was hit.
+=end
+
java_import "com.jme3.app.SimpleApplication"
java_import "com.jme3.collision.CollisionResult"
java_import "com.jme3.collision.CollisionResults"
View
5 lib/sample8.rb
@@ -1,3 +1,8 @@
+=begin
+ This is a full town scene. You can walk, and jump around on the buildings.
+ This sample also takes advantage of loading from a zip file.
+=end
+
java_import "com.jme3.app.SimpleApplication"
java_import "com.jme3.asset.plugins.ZipLocator"
java_import "com.jme3.bullet.BulletAppState"
View
4 lib/sample9.rb
@@ -1,3 +1,7 @@
+=begin
+ This sample creates a full landscape with hills, dirt trails, and rocks from 3 jpg images.
+=end
+
java_import "com.jme3.app.SimpleApplication"
java_import "com.jme3.material.Material"
java_import "com.jme3.terrain.geomipmap.TerrainLodControl"
Please sign in to comment.
Something went wrong with that request. Please try again.