Little Bee in HTML5 canvas games

Source: Internet
Author: User
  • Canvas games are basically pixel control, and are an update-> clear-> draw-> wait loop.
  • Use an object-oriented system to manage display units and stages.
  • Use the Event System to separate the game logic. (In particular, you can handle the status of Multiple game objects at the right time, such as bee colony redirection)
  • Use the simplest data structure to represent and manage bee clusters.
  • Keyboard Input Processing and status management. (How to lock each frame, how to make the multi-Key press not conflict, such as opening fire and moving)
  • Visual residual. (Objects in motion, even a point, will become a line)
  • Filter consecutive function calls. (Throttle processing options: 1) Synchronous 2) asynchronous)
  • Make the frame rate variable at runtime. (Use requestanimationframe to improve performance first)
  • How to get a speed unrelated to the frame rate. (The speed of change, associated with time, calculates the time difference between each frame)
  • Use the save, translate, rotate, and restore methods of the canvas as much as possible.
Click to try




@ 2011-10-09 the old version is in trial. I rewrote it and saved it on GitHub.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.