- 浏览: 4410421 次
- 性别:
- 来自: 湛江
博客专栏
-
SQLite源码剖析
浏览量:80119
-
WIN32汇编语言学习应用...
浏览量:70288
-
神奇的perl
浏览量:103561
-
lucene等搜索引擎解析...
浏览量:286485
-
深入lucene3.5源码...
浏览量:15037
-
VB.NET并行与分布式编...
浏览量:67761
-
silverlight 5...
浏览量:32276
-
算法下午茶系列
浏览量:46066
文章分类
最新评论
-
yoyo837:
counters15 写道目前只支持IE吗?插件的东西是跨浏览 ...
Silverlight 5 轻松开启绚丽的网页3D世界 -
shuiyunbing:
直接在前台导出方式:excel中的单元格样式怎么处理,比如某行 ...
Flex导出Excel -
di1984HIT:
写的很好~
lucene入门-索引网页 -
rjguanwen:
在win7 64位操作系统下,pygtk的Entry无法输入怎 ...
pygtk-entry -
ldl_xz:
http://www.9958.pw/post/php_exc ...
PHPExcel常用方法汇总(转载)
声明:本文为刘兴(http://deepfuture.iteye.com/)原创,如转载请注明来源http://deepfuture.iteye.com/blog/722156
gamemain.as /******************************************************************************* * PushButton Engine * Copyright (C) 2009 PushButton Labs, LLC * For more information see http://www.pushbuttonengine.com * * This file is licensed under the terms of the MIT license, which is included * in the License.html file at the root directory of this SDK. ******************************************************************************/ package mymain { import flash.display.Sprite; import com.pblabs.engine.PBE; import tools.mygameapi; [SWF(width="800", height="600", frameRate="60")] public class gamemain extends Sprite { public function gamemain() { // Start up PBE PBE.startup(this); new MyRes(); // Set up a simple scene entity mygameapi.createScene(); // Create a simple avatar entity mygameapi.createPlane(); mygameapi.createBackground(); // createDd(); } } } DdControllerComponent.as package mymain { import com.pblabs.engine.PBE; import com.pblabs.engine.components.TickedComponent; import com.pblabs.engine.entity.PropertyReference; import flash.geom.Point; public class DdControllerComponent extends TickedComponent { public var positionReference:PropertyReference; public var dname:String; public function DdControllerComponent(name:String){ dname=name; } // onTick() is called every frame public override function onTick(tickRate:Number):void { var position:Point = owner.getProperty(positionReference); // Look at our input keys to see which direction we should move. Left is -x, right is +x. position.y-=5; // Finally, add some boundary limits so that we don't go off the edge of the screen. if (position.y > 260 || position.y < -260) { // Set our position at the wall edge position.y=-400; } // Send our manipulated spatial variables back to the spatial manager owner.setProperty(positionReference, position); if (position.y==-400){ owner.removeComponent(owner.lookupComponentByName(dname+"Render")); owner.removeComponent(owner.lookupComponentByName(dname+"Controller")); } } } } PlaneControllerComponent.as /******************************************************************************* * PushButton Engine * Copyright (C) 2009 PushButton Labs, LLC * For more information see http://www.pushbuttonengine.com * * This file is licensed under the terms of the MIT license, which is included * in the License.html file at the root directory of this SDK. ******************************************************************************/ package mymain { import com.pblabs.engine.PBE; import com.pblabs.engine.components.TickedComponent; import com.pblabs.engine.core.InputKey; import com.pblabs.engine.entity.PropertyReference; import com.pblabs.rendering2D.*; import flash.display.Sprite; import flash.geom.Point; import tools.mygameapi; // Make a ticked component so that it can update itself every frame with onTick() public class PlaneControllerComponent extends TickedComponent { // Keep a property reference to our entity's position. public var positionReference:PropertyReference; public var ddno:uint; public function PlaneControllerComponent() { ddno=0; } // onTick() is called every frame public override function onTick(tickRate:Number):void { var position:Point = owner.getProperty(positionReference); // Look at our input keys to see which direction we should move. Left is -x, right is +x. if (PBE.isKeyDown(InputKey.RIGHT)) { // Move our hero to the right position.x += 15; } if (PBE.isKeyDown(InputKey.LEFT)) { // Move our hero to the left position.x -= 15; } if (PBE.isKeyDown(InputKey.UP)) { // Move our hero to the right position.y -= 15; } if (PBE.isKeyDown(InputKey.DOWN)) { // Move our hero to the left position.y += 15; } if (PBE.isKeyDown(InputKey.F)) { // Move our hero to the left createDd(new Point(position.x,position.y-80)); } // Finally, add some boundary limits so that we don't go off the edge of the screen. if (position.x > 375) { // Set our position at the wall edge position.x = 375; } else if (position.x < -375) { // Set our position at the wall edge position.x = -375; } if (position.y > 260) { // Set our position at the wall edge position.y = 260; } else if (position.y < -260) { // Set our position at the wall edge position.y = -260; } // Send our manipulated spatial variables back to the spatial manager owner.setProperty(positionReference, position); } private function createDd(firstpos:Point):void { // Allocate an entity for our hero avatar var ddname:String=ddno.toString(); mygameapi.createSpatial( owner, // with location of 0,0... firstpos, ddname+"Spatial", new Point(10,50) ); if (ddno<uint.MAX_VALUE){ ddno++; }else{ ddno=0; } // Create an instance of our hero controller component var ddcontroller:DdControllerComponent = new DdControllerComponent(ddname); // Point the controller component to this entity's Spatial component for position information ddcontroller.positionReference = new PropertyReference("@"+ddname+"Spatial.position"); // Add the demo controller component to the Hero entity with the name "Controller" owner.addComponent( ddcontroller, ddname+"Controller" ); // Create a simple render component to display our object var ddrender:SpriteRenderer = new SpriteRenderer(); // Tell the Render component to use one of the images embedded by our ResourceBundle ddrender.fileName = "../assets/dd.gif"; // Add the renderer to the scene. ddrender.scene = PBE.scene; // Set our hero to render above the background. ddrender.layerIndex = 3; // Point the render component to this entity's Spatial component for position information ddrender.positionProperty = new PropertyReference("@"+ddname+"Spatial.position"); // Point the render component to this entity's Spatial component for size information ddrender.sizeProperty = new PropertyReference("@"+ddname+"Spatial.size"); // Add our render component to the Hero entity with the name "Render" owner.addComponent( ddrender, ddname+"Render" ); // Register the entity with PBE under the name "Hero" } } } mygameapi.as package tools { import com.pblabs.engine.PBE; import com.pblabs.engine.entity.*; import com.pblabs.rendering2D.*; import com.pblabs.rendering2D.ui.*; import flash.display.Sprite; import flash.geom.Point; import mymain.PlaneControllerComponent; import mymain.DdControllerComponent; public class mygameapi { public function mygameapi() { } public static function createSpatial( ent:IEntity, pos:Point, name:String,size:Point = null ):void { //创建位置和尺寸信息组件,并加入到入口处 // Create our spatial component var spatial:SimpleSpatialComponent = new SimpleSpatialComponent(); // Do a named lookup to register our background with the scene spatial database spatial.spatialManager = PBE.spatialManager; // Set our background position in space spatial.position = pos; if (size != null) spatial.size = size; ent.addComponent(spatial, name); } public static function createScene():void { var sceneView:SceneView = new SceneView(); // Make the SceneView sceneView.width = 800; sceneView.height = 600; PBE.initializeScene(sceneView); // This is just a helper function that will set up a basic scene for us } public static function createPlane():void { var plane:IEntity = allocateEntity(); // Allocate an entity for our hero avatar //飞机 createSpatial(plane, // with location of 0,0... new Point(0, 0), "PlSpatial", new Point(50,50) ); // Create an instance of our hero controller component var plcontroller:PlaneControllerComponent = new PlaneControllerComponent(); // Point the controller component to this entity's Spatial component for position information plcontroller.positionReference = new PropertyReference("@PlSpatial.position"); // Add the demo controller component to the Hero entity with the name "Controller" plane.addComponent( plcontroller, "PlController" ); // Create a simple render component to display our object var plrender:SpriteRenderer = new SpriteRenderer(); // Tell the Render component to use one of the images embedded by our ResourceBundle plrender.fileName = "../assets/fanship.png"; // Add the renderer to the scene. plrender.scene = PBE.scene; // Set our hero to render above the background. plrender.layerIndex = 2; // Point the render component to this entity's Spatial component for position information plrender.positionProperty = new PropertyReference("@PlSpatial.position"); // Point the render component to this entity's Spatial component for size information plrender.sizeProperty = new PropertyReference("@PlSpatial.size"); // Add our render component to the Hero entity with the name "Render" plane.addComponent( plrender, "PlRender" ); plane.initialize("plane"); } public static function createBackground():void { // Allocate an entity for our background sprite var bg:IEntity = PBE.allocateEntity(); // Add our spatial component to the background entity ... createSpatial( bg, // with location of 0,0... new Point(0, 0), "BgSpatial" ); // Create a simple render component to display our object // Just like the hero, this also uses a SpriteRenderComponent var bgrender:SpriteRenderer = new SpriteRenderer(); // Tell the Render component to use one of the images embedded by our ResourceLinker bgrender.fileName = "../assets/bg.jpg"; // Set our background to render below the hero. bgrender.layerIndex = 1; // Add the renderer to the scene. bgrender.scene = PBE.scene; // Point the render component to this entity's Spatial component for position information bgrender.positionProperty = new PropertyReference("@BgSpatial.position"); // Add our render component to the BG entity with the name "Render" bg.addComponent( bgrender, "BgRender" ); // Register the entity with PBE under the name "BG" bg.initialize("BG"); } } }
注意按F键发导弹
发表评论
-
Firebug-firefox下的编辑JS的利器
2013-02-10 18:54 4704Firebug是一个Firefox插件,集HTML查看和编辑 ... -
15 个顶级 HTML5 游戏引擎
2013-02-10 12:30 54351) HTML5 Game Engine Constr ... -
perl-lwp笔记
2013-02-05 19:51 24132008-01-07 10:25 perl的LWP模块介绍 ... -
perl-opengl几何变换函数
2013-02-01 10:48 1775#!/usr/bin/perl -w use strict ... -
perl-opengl基本图形操作-缩放,二维旋转,二维平移
2013-02-01 09:08 3482#!/usr/bin/perl -w use strict ... -
perl-opengl-glutMotionFunc鼠标事件
2013-01-25 15:54 5159#!/usr/bin/perl -w use stric ... -
perl-opengl-鼠标事件与球体视角
2013-01-25 11:19 2394#!/usr/bin/perl -w use stric ... -
perl-opengl键盘事件与色彩
2013-01-25 09:29 2764#!/usr/bin/perl -w use st ... -
perl-opengl-鼠标事件
2013-01-24 22:43 1994#!/usr/bin/perl -w use s ... -
perl-opengl立方体
2013-01-24 17:44 1810#!/usr/bin/perl -w use strict ... -
perl-opengl画距形
2013-01-24 17:01 1670#!/usr/bin/perl -w use stric ... -
用 X3D 替代 VRML 2.0 的十个理由
2013-01-24 15:24 1552用 X3D 替代 VRML 2.0 的十 ... -
perl-opengl椭圆算法
2013-01-23 17:31 1950#!/usr/bin/perl -w use strict ... -
使用cpan安装Perl模块时自动安装依赖模块的方法
2013-01-23 10:44 3503Comprehensive Perl Archive Net ... -
perl-opengl-直线绘制
2013-01-23 10:43 1506#!/usr/bin/perl -w use strict ... -
perl-opengl指定矩阵-坐标视图
2013-01-22 15:23 1703这两个都是glMatrixMode()函数的参数,那就先说 ... -
perl-opengl多边形近似球体
2013-01-21 21:18 2664#!/usr/bin/perl -w use stric ... -
perl-opengl学习-绘制点
2013-01-21 17:33 1691#!/usr/bin/perl -w use strict ... -
perl-opengl示例程序
2013-01-21 16:22 3267#!/usr/bin/perl -w use strict ... -
开源 Lisp 相关项目
2013-01-19 22:38 3927IOLib 项目 (http://common-lisp.n ...
相关推荐
在“PushButton”这个示例中,我们看到的是如何利用Flex来实现一个简单的飞机移动游戏,其中飞机在背景上进行移动。这篇博客(博文链接:https://deepfuture.iteye.com/blog/709889)可能会详细解释这个过程,包括...
在本文中,我们将深入探讨如何使用Flex游戏引擎PushButton来创建一个简单的键盘控制组件,以实现小球的移动。Flex是一种强大的开源框架,用于构建富互联网应用程序(RIA),而PushButton是其内置的交互式组件之一。...
《Flex游戏引擎与PushButton组件:实现自动行走的小球》 Flex游戏引擎,作为一个强大的开发工具,为创建互动式、富媒体的应用程序提供了便利。在本文中,我们将专注于使用Flex中的PushButton组件来实现一个自动行走...
【PushButton游戏引擎教程与演示详解】 PushButton是一款专为游戏开发设计的游戏引擎,它提供了一种模块化、组件化的编程方式,让开发者可以更灵活地构建游戏。本教程旨在帮助你快速掌握PushButton的基本结构和用法...
而Pushbutton Engine,作为一款强大的Flash游戏开发引擎,为设计师们提供了丰富的游戏组件,让开发者可以更加专注于游戏本身的创新与设计,而非底层技术的实现。 Pushbutton Engine的核心优势在于其对游戏开发流程...
PushButton Engine is a free framework for building Flash games. There are lots of great libraries for Flash game development. PushButton Engine makes it easy to bring those libraries together to build...
一键式语音/停止技能 关于 假设有一个连接到Raspberry Pi的按钮,则会编写此Mycroft技能。 短按该按钮与说出唤醒词相同,然后允许用户说出命令。 长按与发出“停止”命令相同,因此将停止播放任何音频。...
原创pushbutton应用显示多行文字及数学公式-003v2.rar 因為修改太多~重新發帖~ 舊帖請至 https://www.ilovematlab.cn/thread-86806-1-4.html 查看 該函數應該已經很完善 如果有出現問題可至下方網址的日誌回報 ...
### Flash2D+3D游戏引擎详解 #### 一、引言 随着技术的发展与进步,游戏行业也在不断地寻求创新与发展。Flash作为一种重要的游戏开发工具,不仅支持2D游戏的制作,同时也能够实现3D效果。本文将详细介绍几种基于...
ui->pushButton->setEnabled(false); myCom->setBaudRate(BAUD9600); myCom->setDataBits(DATA_8); myCom->setParity(PAR_NONE); myCom->setStopBits(STOP_1); myCom->setTimeout(500); connect(myCom,...
本文主要探讨两个AS3游戏引擎框架:Ffilmation和PushButton Engine。 首先,Ffilmation引擎是一个专为2D和2.5D游戏设计的框架,其特点在于提供了稳定的游戏开发平台,让开发者可以专注于游戏内容的细节,而不是底层...
在Qt编程环境中,Pushbutton(按钮)是一种常用的控件,用于触发用户操作。当你点击一个按钮时,通常会执行预定义的动作。然而,有时我们希望按钮不仅触发单一操作,而是弹出一个菜单供用户选择多种操作。这可以通过...
GIRA PUSHBUTTON SENSOR 4和GIRA TASTSENSOR 4作为智能家居系统中的组成部分,表明智能家居自动化技术已广泛应用于按钮式传感器设备中,提升了用户的居住舒适度和便捷性。 2. GIRA PUSHBUTTON SENSOR 4和GIRA ...
总之,带Icon的自绘PushButton示例展示了MFC中控件自定义的强大能力,它涉及了图形绘制、资源管理、消息处理和事件响应等多个方面,是学习MFC高级特性和Windows API的好材料。通过深入学习和实践,开发者可以提升其...
pushButton->setGeometry(150 + i * 100, 170, 89, 24); pushButton->setText("button " + QString::number(i)); connect(pushButton, &QPushButton::clicked, signalMapper, SLOT(map())); signalMapper->set...
SW PUSHBUTTON SE PUSHBUTTON SW-PB Switch SW-SPDT SPDT Subminiature Toggle Switch, Right Angle Mounting, Vertical Actuation URF04 Ultrasonic wave distanc measure module VS1003b-Module MP3 module XTAL ...
pushbutton1_Callback.m