Skip to main content
Participant
January 15, 2013
Question

Add Obstacle and Health in Android Runner Game

  • January 15, 2013
  • 10 replies
  • 1582 views

I am making a runner game in air for android actionscript 3.

It has two buttons. One for Jumping and one for running. It runs to the right.

As my character runs to the right the background also scrolls to the left.

Now the problem is I need to add some obstacles for the character. The character needs to jump on it to avoid losing life.

How can I add a obstacle and a health bar T_T. Also can the obstacles be on random so that the user won't predict where the obstacles are.

Help me please! I can't figure it out

This topic has been closed for replies.

10 replies

Mark.fromOP
Inspiring
January 16, 2013

You need to look into the collision class in AS3 this can detect when two objects are intersecting. You can put all your obstacles into an Array and then check against that array with a timer or enterFrame event and when they do collide provide a response either destroy the object or the destroy/injure the character, this is where you can deduct from the health bar or whatever the mechanics of your game are.

Here is an example

http://sierakowski.eu/list-of-tips/39-collision-detection-methods-hittest-and-hittestobject-alternatives.html

Known Participant
January 16, 2013

Hmmm i can't figure it out.. There are errors in the codes T_T

Mark.fromOP
Inspiring
January 16, 2013

Here is a simple video explaining this, its much more primative than the article link above, check it out. http://www.youtube.com/watch?v=iUbX9tFtqTg

Colin Holgate
Inspiring
January 15, 2013

It may be worth you going through a tutorial like this one:

http://as3gametuts.com/2011/11/11/platformer-1/

Participant
January 16, 2013

Uhmmm there is no obstacles added there and health bar

Please Help!