public static IceBlock freeze( CharSprite sprite ) { IceBlock iceBlock = new IceBlock( sprite ); if (sprite.parent != null) sprite.parent.add( iceBlock ); return iceBlock; } }
@Override public void destroy() { Keys.event.remove( keyListener ); super.destroy(); }
public static void hit(int pos, float angle) { Group parent = Dungeon.hero.sprite.parent; Surprise s = (Surprise) parent.recycle(Surprise.class); parent.bringToFront(s); s.reset(pos); s.angle = angle; } }
public synchronized Gizmo addToBack( Gizmo g ) { if (g.parent == this) { sendToBack( g ); return g; } if (g.parent != null) { g.parent.remove( g ); } if (members.get( 0 ) == null) { members.set( 0, g ); g.parent = this; return g; } members.add( 0, g ); g.parent = this; length++; return g; }
Group window = new Group(); window.camera = viewport; add( window ); window.add( sky ); star.y = Random.Float( SKY_HEIGHT ) - size / 2; star.am = size * (1 - star.y / SKY_HEIGHT); window.add( star ); for (int i=0; i < NCLOUDS; i++) { Cloud cloud = new Cloud( (NCLOUDS - 1 - i) * (range / NCLOUDS) + Random.Float( range / NCLOUDS ), dayTime ); window.add( cloud ); GrassPatch patch = new GrassPatch( (i - 0.75f) * GrassPatch.WIDTH / 4, SKY_HEIGHT + 1, dayTime ); patch.brightness( dayTime ? 0.7f : 0.4f ); window.add( patch ); a.y = SKY_HEIGHT - a.height; align(a); window.add( a ); pet.y = SKY_HEIGHT - pet.height; align(pet); window.add( pet ); window.add( new TouchArea( sky ) { protected void onClick( Touch touch ) { pet.jump();
public void killAndErase() { kill(); if (parent != null) { parent.erase( this ); } }
@Override public void update() { super.update(); if (countLiving() == 0) { killAndErase(); } }
public void remove() { if (parent != null) { parent.remove( this ); } } }
public Group addVisuals() { if (visuals == null || visuals.parent == null){ visuals = new Group(); } else { visuals.clear(); } for (int i=0; i < length(); i++) { if (pit[i]) { visuals.add( new WindParticle.Wind( i ) ); if (i >= width() && water[i-width()]) { visuals.add( new FlowParticle.Flow( i - width() ) ); } } } return visuals; }
public CircleArc show( Visual visual, float duration ) { point( visual.center() ); visual.parent.addToBack( this ); lifespan = this.duration = duration; return this; }
public Camera camera() { if (camera != null) { return camera; } else if (parent != null) { return this.camera = parent.camera(); } else { return null; } }
@Override protected void createChildren() { sparks = new Group(); add( sparks );
Group window = new Group(); window.camera = viewport; add( window ); window.add( sky ); star.y = Random.Float( SKY_HEIGHT ) - size / 2; star.am = size * (1 - star.y / SKY_HEIGHT); window.add( star ); for (int i=0; i < NCLOUDS; i++) { Cloud cloud = new Cloud( (NCLOUDS - 1 - i) * (range / NCLOUDS) + Random.Float( range / NCLOUDS ), dayTime ); window.add( cloud ); GrassPatch patch = new GrassPatch( (i - 0.75f) * GrassPatch.WIDTH / 4, SKY_HEIGHT + 1, dayTime ); patch.brightness( dayTime ? 0.7f : 0.4f ); window.add( patch ); a.y = SKY_HEIGHT - a.height; align(a); window.add( a ); pet.y = SKY_HEIGHT - pet.height; align(pet); window.add( pet ); window.add( new TouchArea( sky ) { protected void onClick( NoosaInputProcessor.Touch touch ) { pet.jump();
public void hide() { if (parent != null) { parent.erase(this); } destroy(); }
public static void hit( int pos, float angle ) { Group parent = Dungeon.hero.sprite.parent; Wound w = (Wound)parent.recycle( Wound.class ); parent.bringToFront( w ); w.reset( pos ); w.angle = angle; } }
@Override public void update() { super.update(); if (countLiving() == 0) { killAndErase(); } }
public void remove() { if (parent != null) { parent.remove( this ); } } }
public Gizmo addToBack( Gizmo g ) { if (g.parent == this) { sendToBack( g ); return g; } if (g.parent != null) { g.parent.remove( g ); } if (members.get( 0 ) == null) { members.set( 0, g ); g.parent = this; return g; } members.add( 0, g ); g.parent = this; length++; return g; }