开发学院图形图像Flash Box2D platform engine alternative 阅读

Box2D platform engine alternative

 2009-10-18 00:00:00 来源:WEB开发网   
核心提示:Everybody should know Box2D is the best engine you can use to make a platform game.Rick Triqui, my latest game, was made with PlayCrafter that uses Box2D, and I

Everybody should know Box2D is the best engine you can use to make a platform game.

Rick Triqui, my latest game, was made with PlayCrafter that uses Box2D, and I’m starting to code my own Box2D platform engine.

Luis Fernando Silva, author of the upcoming Darkness game (Sponsors! Contact him to see the work in progress! Awesome idea!) wanted to share with us his Box2D platform engine, that made from scratch.

The source code is fully commented, for our pleasure

This is the main file:

package {
 import flash.display.MovieClip;
 
 // Import the levels from the 'Levels' folder:
 import Levels.*;
 
 public class Main extends MovieClip {
  // The game level, re-instanciate this object to
  // switch the levels
  public var level:GameLevel;
 
  // Keyboard listener, got the script at Emanuele's websote
  public var keyboard:keys = new keys(stage);
 
  // Constructor, here these 3 simple lines of code create the level
  // and prepare it to be player
  public function Main() {
   level = new Level1(keyboard); // Create a new level, Level1, in this case
   addChild(level); // Add it to the display object
 
   addEventListener("enterFrame", Update, false, 0, true); // Add a loop
  }
 
  // Update the game here using GameLevel.Update so you can do
  // some general stuff on a main loop instead of using the GameLevel.
  public function Update(e:*) : void {
   level.Update();
  }
 }
}

1 2 3  下一页

Tags:BoxD platform engine

编辑录入:爽爽 [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接