*   >> Lese Utdanning Artikler >> science >> programming

Å gjøre en Space Invaders-klone med taste - Eksplosjoner

id {var posisjoner: Point = owner.getProperty (PositionReference); Var enhet: IEntity = TemplateManager.instance.instantiateEntity ("Explosion"); if (enhet = null!) {var romlig: Box2DSpatialComponent = entity.lookupComponentByType (Box2DSpatialComponent) som Box2DSpatialComponent; Var simpleSpatial: SimpleSpatialComponent = entity.lookupComponentByType (SimpleSpatialComponent) som SimpleSpatialComponent; if (romlig = null) {spatial.position = new Point (position.x, position.y); } Else if (simpleSpatial = null) {simpleSpatial.position = new Point (position.x, position.

y); } Var anim: AnimationController = entity.lookupComponentByType (AnimationController) som AnimationController; if (Anim) anim.setAnimation (anim.animations [anim.defaultAnimation]); }}}

Endelig DestroyIfOffScreenComponent vil telle ned en intern disk, ødelegge enheten som er tilhører en gang at telleren har nådd null

 public class DestroyAfterCountdownComponent strekker TickedComponent {public Var TimeToLive. Number = 1; beskyttet Var remainingTime: Number = 1; offentlig funksjon DestroyAfterCountdownComponent () {super (); } Beskyttet Styringsfunksjonen onAdd (): void {super.

onAdd (); remainingTime = TimeToLive; } Public override funksjonen onTick (tickRate: Number): void {remainingTime - = tickRate; if (remainingTime

Page   <<  [1] [2] [3] 
Copyright © 2008 - 2016 Lese Utdanning Artikler,https://utdanning.nmjjxx.com All rights reserved.