A smart way to manage sleeping objects with Box2D
2009-10-31 00:00:00 来源:WEB开发网核心提示: In the on_time function I added some lines to assign a cubeface object to the rectangle I create.The cubeface object is just a MovieClip with two fr
In the on_time function I added some lines to assign a cubeface object to the rectangle I create.
The cubeface object is just a MovieClip with two frames, one with an happy box and one with a sad one.
Line 43: Assigning the cubeface object to the rectangle
Lines 44-45: Defining movieclip width and height
Line 53: Adding the movieclip on the stage
Later, in the on_enter_frame function, you can find the classic Box2d function used to update sprites (or movieclips) position and rotation.
Lines 62-67: Checking if the body is sleeping with IsSleeping. If the body is sleeping, then stop the movieclip on frame 2 (the happy square), otherwise stop it on frame 1 (the afraid square).
This is the result
本文示例源代码或素材下载
- ››smarty模板嵌套include与fetch性能测试
- ››TOscilloscope 仿Windows任务管理器CPU使用记录组...
- ››tomcat不支持TCP/IP6协议
- ››tomcat 下的 url 大小写问题
- ››tomcat6.0.28 内存溢出PermGen Space
- ››Tomcat 系统架构与设计模式,第 2 部分: 设计模式...
- ››Tomcat 系统架构与设计模式,第 1 部分: 工作原理...
- ››SmartGWT 入门,第 1 部分: 企业级 Web 2.0开发轻...
- ››TOMCAT和IIS整合
- ››Tomcat性能调优方案
- ››Tomcat6 下 MySQL 5.1 数据源配制
- ››Tomcat启动分析server.xml
更多精彩
赞助商链接