Dynamic Collision Area (Flixel)

From Flash Game Dojo

Jump to: navigation, search

Flixel's collision detection is great, but for large-area games (platformers, etc.) it's impractical to hit test the whole area of the game in every frame. Here is how to check for collisions in ONLY the area of the screen that is currently in the game's view.

Inside your State class:

override public function update():void
	{
        	FlxU.setWorldBounds(-(FlxG.scroll.x), -(FlxG.scroll.y), FlxG.width, FlxG.height);
		collide()
		super.update();
	}
 
Retrieved from "flashgamedojo.com/wiki/index.php?title=Dynamic_Collision_Area_(Flixel)"
Views
  • Page
  • Discussion
  • View source
  • History
Personal tools
  • Log in
Navigation
  • Home
  • About
  • Contribute
  • Requests
  • Random
  • Help
Content
  • Game Design
  • Tutorials

  • Snippets
  • Flixel
  • FlashPunk

  • Tools
  • Art
  • Audio
Toolbox
  • What links here
  • Related changes
  • Special pages
  • Printable version
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.