ch.aplu.jcardgame
Class CardCover

java.lang.Object
  extended by ch.aplu.jgamegrid.Actor
      extended by ch.aplu.jcardgame.CardCover
All Implemented Interfaces:
GGActorCollisionListener, GGBorderListener, GGTileCollisionListener, java.util.EventListener

public class CardCover
extends Actor

Class that represents the cover (back) of a card (card with face down). This class derives from Actor and can be used as such. Be careful when overriding the act() method because it is used for the slide animation.


Field Summary
 
Fields inherited from class ch.aplu.jgamegrid.Actor
nbCycles
 
Constructor Summary
CardCover(GameGrid gameGrid, Location location, Deck deck, double scaleFactor, double rotationAngle)
          Same as CardCover(gameGrid, location, deck, scaleFactor, rotationAngle, hide) with show = true.
CardCover(GameGrid gameGrid, Location location, Deck deck, double scaleFactor, double rotationAngle, boolean show)
          Creates a transformed card cover actor from the seed actor of the first card in the given deck and adds it at the given location to the given game grid.
 
Method Summary
 void act()
          For internal use only.
 void putOnTop(boolean onTop)
          Sets the card cover actor above or below any other card actors and card covers.
 void slideToTarget(Location targetLocation, int slideStep, boolean onTop, boolean blocking)
          Slides the card cover actor from the current location to the given target location using the given step.
 
Methods inherited from class ch.aplu.jgamegrid.Actor
addActorCollisionListener, addBorderListener, addCollisionActor, addCollisionActors, addCollisionActors, addCollisionTile, addCollisionTiles, addCollisionTiles, addMouseTouchListener, addMouseTouchListener, addTileCollisionListener, collide, collide, delay, displace, getBackground, getCollisionActors, getCollisionActorsInRange, getCollisionTiles, getCurrentImage, getDirection, getDirectionStart, getDisplacePosition, getHeight, getIdVisible, getImage, getImage, getIntDirection, getLocation, getLocationOffset, getLocationStart, getNbCycles, getNbHorzCells, getNbSprites, getNbVertCells, getNeighbours, getNeighbours, getNextMoveLocation, getPixelColor, getPixelLocation, getRotatedPosition, getRotationIndex, getScaledImage, getScaledImage, getScaledImage, getSlowDown, getWidth, getX, getXStart, getY, getYStart, hide, isActEnabled, isActorCollisionEnabled, isHorzMirror, isInGrid, isMoveValid, isNearBorder, isRemoved, isRotatable, isTileCollisionEnabled, isVertMirror, isVisible, move, move, nearBorder, removeSelf, reset, rotate, rotate, setActEnabled, setActorCollisionEnabled, setCollisionCircle, setCollisionCircle, setCollisionImage, setCollisionImage, setCollisionLine, setCollisionLine, setCollisionRectangle, setCollisionRectangle, setCollisionSpot, setCollisionSpot, setDirection, setDirection, setDisplacePosition, setHorzMirror, setLocation, setLocationOffset, setLocationOffset, setMouseTouchCircle, setMouseTouchCircle, setMouseTouchEnabled, setMouseTouchImage, setMouseTouchImage, setMouseTouchRectangle, setMouseTouchRectangle, setOnBottom, setOnTop, setPixelLocation, setSlowDown, setTileCollisionEnabled, setVertMirror, setX, setY, show, show, showNextSprite, showPreviousSprite, turn
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CardCover

public CardCover(GameGrid gameGrid,
                 Location location,
                 Deck deck,
                 double scaleFactor,
                 double rotationAngle)
Same as CardCover(gameGrid, location, deck, scaleFactor, rotationAngle, hide) with show = true.

Parameters:
gameGrid - the GameGrid reference
location - the location where the actor is shown
deck - the deck where to take the seed actor
scaleFactor - the scale factor (1: no scaling) applied to seed actor
rotationAngle - the rotation angle (in degrees, clockwise) applied to the seed actor

CardCover

public CardCover(GameGrid gameGrid,
                 Location location,
                 Deck deck,
                 double scaleFactor,
                 double rotationAngle,
                 boolean show)
Creates a transformed card cover actor from the seed actor of the first card in the given deck and adds it at the given location to the given game grid. The game grid is not refreshed automatically.

Parameters:
gameGrid - the GameGrid reference
location - the location where the actor is shown
deck - the deck where to take the seed actor
scaleFactor - the scale factor (1: no scaling) applied to seed actor
rotationAngle - the rotation angle (in degrees, clockwise) applied to the seed actor
show - if true, the actor is shown; otherwise it is hidden (use Actor.show() or slideToTarget() to show it)
Method Detail

slideToTarget

public void slideToTarget(Location targetLocation,
                          int slideStep,
                          boolean onTop,
                          boolean blocking)
Slides the card cover actor from the current location to the given target location using the given step. The actor is not removed at the target location (use removeSelf() if needed).

Parameters:
targetLocation - the location where the movement ends
slideStep - the number of moving steps in one simulation cycle; if zero, the actor jumps immediately to the target location
onTop - if true, the actor is shown on top of any other card actors; otherwise it is shown below other card actors and card covers.
blocking - if true, the methods blocks until the actor arrives at the target; otherwise the method returns immediately

act

public void act()
For internal use only. Overrides Actor.act().

Overrides:
act in class Actor

putOnTop

public void putOnTop(boolean onTop)
Sets the card cover actor above or below any other card actors and card covers.

Parameters:
onTop - if true, the actor is shown on top; otherwise it is shown at bottom (the paint order is modified).