谁能帮我改一下as3代码?
按理说一个影片剪辑链接上这个类之后会动,但我将一个影片剪辑链接上这个类之后,发现元件并没有动,能不能帮我改一下?类的名字叫snow,继承自sprite。package{i...
按理说一个影片剪辑链接上这个类之后会动,但我将一个影片剪辑链接上这个类之后,发现元件并没有动,能不能帮我改一下?类的名字叫snow,继承自sprite。
package {
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class snow extends Sprite {
public function snow():void {
var timer:Timer=new Timer(10);
var timer2:Timer=new Timer(500);
timer.addEventListener(TimerEvent.TIMER,timeevent);
timer.start();
timer2.addEventListener(TimerEvent.TIMER,timeevent2);
timer2.start();
var time:Number=0;
var airgval:Number=0;
var gravityAclt:Number=0;
var ballong:Number=this.height;
var Ran:Number=0;
var Ran2:Number=0;
var Ranx:Number=0;
var Cw:Number=1;
function timeevent(a) {
test();
valadd();
gravity();
hoZonTalAclt();
Ran=Math.random()/2;
}
function timeevent2(a) {
Ran2=Math.random();
}
function valadd():void {
airgval=1/16*ballong*Cw*gravityAclt;//空气阻力计算公式Fw=1/16·A·Cw·v2(kg)
time+=0.01;
gravityAclt=Math.pow(time,2)*9.8/2;
}
function gravity() {
this.y+=gravityAclt-airgval;//重力加速度计算公式Vn=1/2*gt^2
}
function hoZonTalAclt() {//水平随机左右加速
if (Ran2>=0.5) {
this.x-=Ran/2;
} else if (Ran2<=0.5) {
this.x+=Ran/2;
} else {
}
}
function rot() {
this.rotation-=this.x-Ran;
}
function test():void {
}
}
}
} 展开
package {
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class snow extends Sprite {
public function snow():void {
var timer:Timer=new Timer(10);
var timer2:Timer=new Timer(500);
timer.addEventListener(TimerEvent.TIMER,timeevent);
timer.start();
timer2.addEventListener(TimerEvent.TIMER,timeevent2);
timer2.start();
var time:Number=0;
var airgval:Number=0;
var gravityAclt:Number=0;
var ballong:Number=this.height;
var Ran:Number=0;
var Ran2:Number=0;
var Ranx:Number=0;
var Cw:Number=1;
function timeevent(a) {
test();
valadd();
gravity();
hoZonTalAclt();
Ran=Math.random()/2;
}
function timeevent2(a) {
Ran2=Math.random();
}
function valadd():void {
airgval=1/16*ballong*Cw*gravityAclt;//空气阻力计算公式Fw=1/16·A·Cw·v2(kg)
time+=0.01;
gravityAclt=Math.pow(time,2)*9.8/2;
}
function gravity() {
this.y+=gravityAclt-airgval;//重力加速度计算公式Vn=1/2*gt^2
}
function hoZonTalAclt() {//水平随机左右加速
if (Ran2>=0.5) {
this.x-=Ran/2;
} else if (Ran2<=0.5) {
this.x+=Ran/2;
} else {
}
}
function rot() {
this.rotation-=this.x-Ran;
}
function test():void {
}
}
}
} 展开
展开全部
package
{
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class snow extends Sprite
{
var time:Number = 0;
var airgval:Number = 0;
var gravityAclt:Number = 0;
var ballong:Number;
var Ran:Number = 0;
var Ran2:Number = 0;
var Ranx:Number = 0;
var Cw:Number = 1;
public function snow()
{
ballong = this.height;
var timer:Timer = new Timer(10);
var timer2:Timer = new Timer(500);
timer.addEventListener(TimerEvent.TIMER,timeevent);
timer.start();
timer2.addEventListener(TimerEvent.TIMER,timeevent2);
timer2.start();
}
private function timeevent(e:TimerEvent):void
{
test();
valadd();
gravity();
hoZonTalAclt();
Ran = Math.random() / 2;
}
private function timeevent2(e:TimerEvent):void
{
Ran2 = Math.random();
}
private function valadd():void
{
airgval = 1 / 16 * ballong * Cw * gravityAclt;//空气阻力计算公式Fw=1/16·A·Cw·v2(kg)
time += 0.01;
gravityAclt = Math.pow(time,2) * 9.8 / 2;
}
private function gravity():void
{
this.y += gravityAclt - airgval;//重力加速度计算公式Vn=1/2*gt^2
}
private function hoZonTalAclt():void
{//水平随机左右加速
if (Ran2 >= 0.5)
{
this.x -= Ran / 2;
}
else if (Ran2<=0.5)
{
this.x += Ran / 2;
}
else
{
}
}
private function rot():void
{
this.rotation -= this.x - Ran;
}
private function test():void
{
}
}
}
{
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class snow extends Sprite
{
var time:Number = 0;
var airgval:Number = 0;
var gravityAclt:Number = 0;
var ballong:Number;
var Ran:Number = 0;
var Ran2:Number = 0;
var Ranx:Number = 0;
var Cw:Number = 1;
public function snow()
{
ballong = this.height;
var timer:Timer = new Timer(10);
var timer2:Timer = new Timer(500);
timer.addEventListener(TimerEvent.TIMER,timeevent);
timer.start();
timer2.addEventListener(TimerEvent.TIMER,timeevent2);
timer2.start();
}
private function timeevent(e:TimerEvent):void
{
test();
valadd();
gravity();
hoZonTalAclt();
Ran = Math.random() / 2;
}
private function timeevent2(e:TimerEvent):void
{
Ran2 = Math.random();
}
private function valadd():void
{
airgval = 1 / 16 * ballong * Cw * gravityAclt;//空气阻力计算公式Fw=1/16·A·Cw·v2(kg)
time += 0.01;
gravityAclt = Math.pow(time,2) * 9.8 / 2;
}
private function gravity():void
{
this.y += gravityAclt - airgval;//重力加速度计算公式Vn=1/2*gt^2
}
private function hoZonTalAclt():void
{//水平随机左右加速
if (Ran2 >= 0.5)
{
this.x -= Ran / 2;
}
else if (Ran2<=0.5)
{
this.x += Ran / 2;
}
else
{
}
}
private function rot():void
{
this.rotation -= this.x - Ran;
}
private function test():void
{
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询