MAKE A RACETRACK!

Let the player race against NPC's around a track to win!

  • Huepow00
  • 10/22/2007 12:00 AM
  • 3525 views
RACE INFO

The player races around the track by following waypoints. The waypoints are used to determine that the hero is on the track and moving in the correct direction.

Waypoints activate the next in order, then deactivate themselves. The trick with placing the waypoints is that they must be gone through in order... So placing them in such a way so that the player is bound or forced to go through them is key.
Other NPC's (Non-Playable Characters) can race on the track as well!

This is just a basic engine - but it can be tweaked and added to... There is A LOT of room for additional game play variants.

VIEW IMAGE OF A TEST MAP

EVENT : Race Start End

PAGE 01
> Auto-Start Trigger
> Below Hero

Message: 3!
Message: 2!
Message: 1!
Message: GO!!!
Switch Operation: ON
Switch Operation: ON

PAGE 02
> Parallel Process Trigger
> Below Hero
> Preconditions = is ON

Branch if Var is 3
Message: You Win!
Return to Title Screen

: Else Handler

: End

Page 1 starts the race with a countdown and lets the game know it's started.
Page 2 waits for the LAP variable to reach 3 to show you've won.


EVENT : NPC Lap Counter

PAGE 01
> Parallel Process Trigger
> Below Hero

PAGE 02
> Parallel Process Trigger
> Below Hero
> Preconditions = is ON

Branch if Var is 3
Tint Screen: (R100,G100,B100,S000), 0.4 Sec
Message: You Loose...
Return to Title Screen

: Else Handler
Variable Oper: + , 1
Switch Opperation: OFF

: End

On Page 2 - When the NPC's Custom Patch triggers the NPC LAP COUNTER switch to ON
1) If the NPC's LAP variable is 3 its GAME OVER
2) If not, it add's 1 unit to the NPC LAP variable and then turns itself off.


EVENT : NPC 01

PAGE 01
> Parallel Process Trigger
> Same Layer as Hero
> Movement Type = Stationary

PAGE 02
> Parallel Process Trigger
> Preconditions = is ON
> Same Layer as Hero
> Movement Type = Custom Pattern - Repeat Pattern
!! While making the Custom path for the NPC - At the moment it touches the Lap Point marker. Include:
Switch ON "NPC Lap Counter"


PAGE 03
> Parallel Process Trigger
> Preconditions = is Equal to 3
> Same Layer as Hero
> Movement Type = Stationary

The NPC waits for the race to begin, then follow's its set path around the track.
Each time it pass's the Start/Finish line (Lap Point) - It activates the NPC Lap Counter event to tell the game it's made 1 lap.


EVENT : Waypoint "#"

PAGE 01
> Parallel Process Trigger
> Below Hero

PAGE 02
> Touched by Hero
> Below Hero

Branch if Hero "The Direction Intended" Facing
Switch Operation: ON (or Lap Point if it's the end of the loop)
Switch Operation: OFF

: Else Handler

: End

Waypoints first check if the Hero is facing the direction he's supposed to be moving along the track.
If they are, it Activates the next Waypoint, and then turns itself OFF.


EVENT : Lap Point

PAGE 01
> Parallel Process Trigger
> Below Hero

PAGE 02
> Touched by Hero
> Below Hero

Branch if Hero "The Direction Intended" Facing
Switch Operation: ON
Variable Oper: + , 1
Switch Operation: OFF

: Else Handler

: End

Page 02 first checks the player is passing through in the correct direction.
Then it turns on the first waypoint in the loop again.
Add's 1 unit to the players 'Race Laps' Variable
Then turns itslef off.


Proposed Add-Ons

Player with NPC Collision Options:

# Collision with NPC blows up the player.
# Collision with NPC blows up the NPC.
# Collision with NPC from behind slows down player temporarily.
# Collision with NPC from the front slows down NPC temporarily.
# Collision with NPC gives damage to the NPC, player, or both.
# Collision with NPC moves to a random, straight piece of track. NPC is set to move towards Hero - while the player must pass the NPC and reach the end to pass the NPC in-race. Causes the 2 events to swap places.

Player with Object Collision Options:

# Collision with wall blows up the player.
# Collision with wall gives damage to the player.
# Collision with explosive obstacles blows up the player.
# Collision with dirt slows down the player.
# Collision with water stops or slows down the player.
# Collision with Oil Slick forces the player forwards with no control temporarily.
# Collision with Speed Pad increases the player or NPC's Speed temporarily.
# Collision with Ice keeps the player & NPC's moving forward, but let's them also move side to side.

Posts

Pages: 1
This could come in useful in one of my future games.
I apologize that the names of the switches and variables I was reffering to in this tut are now not shown... They were inside " " and were removed when uploaded...

Hopefully you can understand it on your own... I'm told their working on removing it so I can re-upload this tut with the fix's
Pages: 1