[alienbloodbath commit] r68 - in trunk: content_package res/drawable src/android/com/abb

0 views
Skip to first unread message

codesite...@google.com

unread,
Jan 8, 2009, 12:37:35 AM1/8/09
to alien-blood-b...@googlegroups.com
Author: matt.burkhart
Date: Wed Jan 7 20:30:11 2009
New Revision: 68

Modified:
trunk/content_package/jump.humanoid.animation
trunk/res/drawable/icon.png
trunk/src/android/com/abb/Avatar.java
trunk/src/android/com/abb/Entity.java
trunk/src/android/com/abb/GameState.java
trunk/src/android/com/abb/GameView.java

Log:
Increase max frame rate limiter. Replace game icon. Tweaked animation
constants.

Modified: trunk/content_package/jump.humanoid.animation
==============================================================================
--- trunk/content_package/jump.humanoid.animation (original)
+++ trunk/content_package/jump.humanoid.animation Wed Jan 7 20:30:11 2009
@@ -2,7 +2,7 @@
center_y 20

root 0.0 0
-root 1.0 360
+root 0.5 360

thigh_r 0.0 -45
thigh_l 0.0 -40

Modified: trunk/res/drawable/icon.png
==============================================================================
Binary files. No diff available.

Modified: trunk/src/android/com/abb/Avatar.java
==============================================================================
--- trunk/src/android/com/abb/Avatar.java (original)
+++ trunk/src/android/com/abb/Avatar.java Wed Jan 7 20:30:11 2009
@@ -46,6 +46,13 @@
ddx = -kAirAcceleration;
}

+ // The following is a poor hack to simulate "friction" against the
ground
+ // surface. The problem with this implementation is that it does not
account
+ // for the time_step. TODO(burkhart): Fix this friction implementation.
+ if (has_ground_contact && ddx == 0.0f) {
+ dx *= (1.0f - kGroundKineticFriction);
+ }
+
// Update the avatar animation frame according the current entity
motion.
if (dx < 0) {
sprite_flipped_horizontal = true;
@@ -131,9 +138,10 @@
private static final float kAirAcceleration = 40.0f;
private static final float kAnimationStopThreshold = 40.0f;
private static final float kDrawingScale = 0.4f;
- private static final float kGravity = 200.0f;
+ private static final float kGravity = 300.0f;
private static final float kGroundAcceleration = 700.0f;
- private static final float kGroundAnimationSpeed = 1.0f / 500.0f;
+ private static final float kGroundAnimationSpeed = 1.0f / 1500.0f;
+ private static final float kGroundKineticFriction = 0.3f;
private static final float kJumpVelocity = 250.0f;
private static final int kKeyLeft = KeyEvent.KEYCODE_A;
private static final int kKeyRight = KeyEvent.KEYCODE_S;

Modified: trunk/src/android/com/abb/Entity.java
==============================================================================
--- trunk/src/android/com/abb/Entity.java (original)
+++ trunk/src/android/com/abb/Entity.java Wed Jan 7 20:30:11 2009
@@ -19,8 +19,8 @@
import java.util.Random;


-/** The Entity class is intended to be lowest level, drawable, physical
- * in-game object. */
+/** The Entity class is intended to be lowest level, drawable, physical
in-game
+ * object. */
public class Entity {
public boolean alive = true; // Should not be deleted from the game.
public boolean has_ground_contact;
@@ -47,13 +47,6 @@
dx += ddx * time_step;
dy += ddy * time_step;

- // The following is a poor hack to simulate "friction" against the
ground
- // surface. The problem with this implementation is that it does not
account
- // for the time_step. TODO(burkhart): Fix this friction implementation.
- if (has_ground_contact) {
- dx *= (1.0f - kGroundKineticFriction);
- }
-
dx = Math.max(dx, -kMaxVelocity);
dx = Math.min(dx, kMaxVelocity);
dy = Math.max(dy, -2.0f * kMaxVelocity);
@@ -85,6 +78,5 @@

protected static Random mRandom = new Random();

- private static final float kGroundKineticFriction = 0.2f;
private static final float kMaxVelocity = 200.0f;
}

Modified: trunk/src/android/com/abb/GameState.java
==============================================================================
--- trunk/src/android/com/abb/GameState.java (original)
+++ trunk/src/android/com/abb/GameState.java Wed Jan 7 20:30:11 2009
@@ -93,9 +93,9 @@
mTargetViewX = avatar.x + kViewLead * avatar.dx;
mTargetViewY = avatar.y + kViewLead * avatar.dy;

- mZoom += (mTargetZoom - mZoom) * kZoomSpeed;
- mViewX += (mTargetViewX - mViewX) * kViewSpeed;
- mViewY += (mTargetViewY - mViewY) * kViewSpeed;
+ mZoom += (mTargetZoom - mZoom) * kZoomSpeed * time_step;
+ mViewX += (mTargetViewX - mViewX) * kViewSpeed * time_step;
+ mViewY += (mTargetViewY - mViewY) * kViewSpeed * time_step;

// Step the avatar.
if (avatar.alive) {
@@ -290,6 +290,6 @@
private static final float kGroundZoom = 0.8f;
private static final long kVibrateLength = 30; // Milliseconds.
private static final float kViewLead = 1.0f;
- private static final float kViewSpeed = 0.1f;
- private static final float kZoomSpeed = 0.05f;
+ private static final float kViewSpeed = 2.0f;
+ private static final float kZoomSpeed = 1.0f;
}

Modified: trunk/src/android/com/abb/GameView.java
==============================================================================
--- trunk/src/android/com/abb/GameView.java (original)
+++ trunk/src/android/com/abb/GameView.java Wed Jan 7 20:30:11 2009
@@ -65,13 +65,13 @@
// framerate to something "reasonable" and 2) pause the updates as
much as
// possible. Here we define the maximum framerate which needs to
make the
// trade off between graphics fluidity and power savings.
- final float kMaxFrameRate = 15.0f; // Frames / second.
+ final float kMaxFrameRate = 30.0f; // Frames / second.
final float kMinFrameRate = 5.0f; // Frames / second.
final float kMinTimeStep = 1.0f / kMaxFrameRate; // Seconds.
final float kMaxTimeStep = 1.0f / kMinFrameRate; // Seconds.

- // The timers available through the Java APIs appear sketchy in
general. I
- // was able to find the following resource useful:
+ // The timers available through the Java APIs appear sketchy in
general.
+ // The following resource was useful:
// http://blogs.sun.com/dholmes/entry/inside_the_hotspot_vm_clocks
long time = System.nanoTime();

Reply all
Reply to author
Forward
0 new messages