// Constructors/Destructors: ------------------------------------------- public GameSprite() { //SPRITE COLOR! //set the default color to white this.poColor = new Azul.Color(defaultSpriteColor_White); Debug.Assert(this.poColor != null); //default field values this.name = Name.Blank; //create a NullObject image by default to avoid breaking find; this.pImage = ImageManager.Find(Image.Name.NullObject); Debug.Assert(this.pImage != null); Debug.Assert(pPrivScreenRect != null); Debug.Assert(defaultSpriteColor_White != null); this.poScreenRect = new Azul.Rect(pPrivScreenRect); Debug.Assert(poScreenRect != null); this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), pPrivScreenRect, this.poColor); Debug.Assert(this.poAzulSprite != null); this.x = poAzulSprite.x; this.y = poAzulSprite.y; this.sx = poAzulSprite.sx; this.sy = poAzulSprite.sy; this.angle = poAzulSprite.angle; }
//static Azul.Rect poRect = new Azul.Rect(); public GameSprite() : base() { this.name = GameSprite.Name.Unitialized; //use the default for now and replace later in the Set this.pImage = ImageMan.Find(Image.Name.Default); Debug.Assert(this.pImage != null); this.poScreenRect = new Azul.Rect(); Debug.Assert(this.pImage != null); //make sure nothing is there already? this.poScreenRect.Clear(); Debug.Assert(GameSprite.psTempColor != null); GameSprite.psTempColor.Set(1, 1, 1); this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, psTempColor); Debug.Assert(this.poAzulSprite != null); this.poAzulColor = new Azul.Color(1, 1, 1); Debug.Assert(this.poAzulColor != null); this.x = poAzulSprite.x; this.y = poAzulSprite.y; this.sx = poAzulSprite.sx; this.sy = poAzulSprite.sy; this.angle = poAzulSprite.angle; }
public Sprite() { this.name = Sprite.Name.Uninitialized; this.pImage = ImageManager.Find(Image.Name.Uninitialized); Debug.Assert(this.pImage != null); this.poScreenRect = new Azul.Rect(); Debug.Assert(this.poScreenRect != null); this.poScreenRect.Clear(); this.poColor = new Azul.Color(1, 1, 1); Debug.Assert(this.poColor != null); this.poSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), poScreenRect, poColor); Debug.Assert(this.poSprite != null); this.x = poSprite.x; this.y = poSprite.y; this.sx = poSprite.sx; this.sy = poSprite.sy; this.angle = poSprite.angle; this.speedX = 0; this.speedY = 0; }
//--------------------------------------------------------------------------------------------------------- // Constructor //--------------------------------------------------------------------------------------------------------- public GameSprite() : base() { this.name = GameSprite.Name.Uninitialized; // Use the default - it will be replaced in the Set this.pImage = ImageManager.Find(Image.Name.Default); Debug.Assert(this.pImage != null); this.poScreenRect = new Azul.Rect(); Debug.Assert(this.poScreenRect != null); this.poScreenRect.Clear(); // here is the actual new this.poAzulColor = new Azul.Color(1, 1, 1); Debug.Assert(this.poAzulColor != null); // here is the actual new this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, psTmpColor); Debug.Assert(this.poAzulSprite != null); this.x = poAzulSprite.x; this.y = poAzulSprite.y; this.sx = poAzulSprite.sx; this.sy = poAzulSprite.sy; this.angle = poAzulSprite.angle; }
public override void Execute(float deltaTime) { GhostManager pGhostManager = GameStateManager.GetGame().GetStateGhostManager(); GameObjectManager pGameObjectManager = GameStateManager.GetGame().GetStateGameObjectManager(); SpriteBatchManager pSpriteBatchManager = GameStateManager.GetGame().GetStateSpriteBatchManager(); Composite pCoreCannonGroup = GameStateManager.GetGame().GetStateCompositeManager().Find(Composite.CompositeName.CoreCannonGroup); GameObject pGameObj = pGhostManager.Find(GameObject.Name.CoreCannon); // Remove game object from ghost manager pGhostManager.Detach(pGameObj); // Reset position pGameObj.SetX(200); pGameObj.SetY(100); // Reset Collision Object Azul.Rect pSpriteProxyScreenRect = pGameObj.GetSpriteProxy().GetSpriteScreenRect(); CollisionObject pCollisionObject = pGameObj.GetCollisionObject(); pCollisionObject.GetCollisionRect().Set(pSpriteProxyScreenRect); pCollisionObject.GetCollisionSpriteBox().Set(SpriteBox.Name.Box, 200, 100, pSpriteProxyScreenRect.width, pSpriteProxyScreenRect.height); // Add to GameObjectManager Debug.Assert(pGameObj != null); pGameObjectManager.Attach(pGameObj); // Add to Composite pCoreCannonGroup.Add(pGameObj); // Attach to SpriteBatch pGameObj.ActivateSprite(pSpriteBatchManager.Find(SpriteBatch.Name.CoreCannon)); pGameObj.ActivateCollisionSprite(pSpriteBatchManager.Find(SpriteBatch.Name.CollisionBox)); }
public void Set(GameSprite.Name boxName, Azul.Rect pScreenRect) { //null checks Debug.Assert(pScreenRect != null); Debug.Assert(defaultBoxColor_Red != null); Debug.Assert(this.poAzulSpriteBox != null); Debug.Assert(this.poScreenRect != null); //set the name this.name = boxName; Debug.Assert(pPrivScreenRect != null); //set either a default color or a color input; //if (pColor == null) //{ // //set to static red (default) // this.poLineColor.Set(defaultBoxColor_Red); //} //else //{ // this.poLineColor.Set(pColor); //} this.poAzulSpriteBox.Swap(pScreenRect, this.poLineColor); Debug.Assert(this.poAzulSpriteBox != null); this.x = poAzulSpriteBox.x; this.y = poAzulSpriteBox.y; this.sx = poAzulSpriteBox.sx; this.sy = poAzulSpriteBox.sy; this.angle = poAzulSpriteBox.angle; }
public Mine(Azul.Rect destRect, int owner, Azul.Color color) : base(GAMEOBJECT_TYPE.MINE, new Azul.Rect(0, 0, 12, 12), destRect, GameObject.mineTexture, color) { PhysicBody_Data data = new PhysicBody_Data(); data.position = new Vec2(destRect.x, destRect.y); data.size = new Vec2(destRect.width, destRect.height); //data.radius = 25f; data.isSensor = true; data.angle = 0; data.shape_type = PHYSICBODY_SHAPE_TYPE.DYNAMIC_BOX; ownerID = owner; lifeTime = 5.0f; armDelay = 2.0f; mine1 = pSprite; mine2 = new Azul.Sprite(GameObject.mineTexture2, new Azul.Rect(0, 0, 12, 12), destRect, new Azul.Color(1, 0, 0)); drawMine2 = false; CreatePhysicBody(data); lifeTimer = new Stopwatch(); animTimer = new Stopwatch(); animTimer.Start(); armedTimer = new Stopwatch(); armedTimer.Start(); state = MINE_STATE.LAYED; }
public Glyph() : base() { this.glyphName = Name.Uninitialized; this.glyphTex = null; this.glyphRect = new Azul.Rect(); this.key = 0; }
public BoxSprite() { //set the name; this.name = GameSprite.Name.Blank; Debug.Assert(pPrivScreenRect != null); Debug.Assert(defaultBoxColor_Red != null); //initialize default line color of all sprite box objects this.poLineColor = new Azul.Color(defaultBoxColor_Red); Debug.Assert(this.poLineColor != null); //initialize screen coordinates this.poScreenRect = new Azul.Rect(pPrivScreenRect); Debug.Assert(this.poScreenRect != null); //initialize azul sprite box this.poAzulSpriteBox = new Azul.SpriteBox(pPrivScreenRect, this.poLineColor); Debug.Assert(this.poAzulSpriteBox != null); //pull the coordinates this.x = poAzulSpriteBox.x; this.y = poAzulSpriteBox.y; this.sx = poAzulSpriteBox.sx; this.sy = poAzulSpriteBox.sy; this.angle = poAzulSpriteBox.angle; }
public Ship(Azul.Rect screenRect, Azul.Color color) : base(GAMEOBJECT_TYPE.SHIP, new Azul.Rect(0, 0, 32, 32), screenRect, GameObject.shipTexture, color) { PhysicBody_Data data = new PhysicBody_Data(); data.position = new Vec2(screenRect.x, screenRect.y); data.size = new Vec2(screenRect.width, screenRect.height); data.active = true; data.angle = 0; data.shape_type = PHYSICBODY_SHAPE_TYPE.SHIP_MANIFOLD; //data.isSensor = true; CreatePhysicBody(data); // maxSpeed is m/s maxSpeed = 150.0f; maxForce = 20f; rotateSpeed = 5.0f; heading = new Vec2((float)System.Math.Cos(pBody.GetAngleDegs()), (float)System.Math.Sin(pBody.GetAngleDegs())); mineCount = 5; missileCount = 3; shipColor = color; respawnPos = new Vec2(screenRect.x, screenRect.y); }
public static Azul.Rect[] GetRects(CharacterEnum typeIn) { Azul.Rect[] arrayOut = new Azul.Rect[2]; switch (typeIn) { case CharacterEnum.octopus: arrayOut[0] = GetRect(RectType.Octopus1); arrayOut[1] = GetRect(RectType.Octopus2); break; case CharacterEnum.crab: arrayOut[0] = GetRect(RectType.Crab1); arrayOut[1] = GetRect(RectType.Crab2); break; case CharacterEnum.squid: arrayOut[0] = GetRect(RectType.Squid1); arrayOut[1] = GetRect(RectType.Squid2); break; case CharacterEnum.corecannon: arrayOut[0] = GetRect(RectType.CoreCannon1); break; case CharacterEnum.missle: arrayOut = GetCCMissles(); break; default: break; } return(arrayOut); }
public Ship(Azul.Rect screenRect, Azul.Color color) : base(GAMEOBJECT_TYPE.SHIP, new Azul.Rect(0, 0, 32, 32), screenRect, GameObject.shipTexture, color) { //PhysicBody_Data data = new PhysicBody_Data(); //data.position = new Vec2(screenRect.x, screenRect.y); //data.size = new Vec2(screenRect.width, screenRect.height); //data.angle = 0; //data.shape_type = PHYSICBODY_SHAPE_TYPE.SHIP_MANIFOLD; //CreatePhysicBody(data); //maxSpeed is pixels / sec maxSpeed = 150.0f; maxForce = 20f; rotateSpeed = 5.0f; // heading = new Vec2((float)System.Math.Cos(pBody.GetAngleDegs()), (float)System.Math.Sin(pBody.GetAngleDegs())); prevPos = new Vec2(screenRect.x, screenRect.y); curPos = prevPos; //prevTime = GetTime(); //curTime = prevTime; curVelocity = new Vec2(0.0f, 0.0f); missileCount = 3; shipColor = color; respawnPos = new Vec2(screenRect.x, screenRect.y); }
//---------------------------------------------------------------------------------- // Constructor //---------------------------------------------------------------------------------- public Glyph() : base() { this.name = Glyph.Name.Uninitialized; this.pTexture = null; this.pSubRect = new Azul.Rect(); this.key = 0; }
public GameSprite() : base() { // resets to default parameters this.Wash(); // Use Default Values this.pImage = ImageManager.Find(Image.Name.Default); Debug.Assert(pImage != null); // Prep Rect this.poScreenRect = new Azul.Rect(); Debug.Assert(this.poScreenRect != null); this.poScreenRect.Clear(); // Prep Color this.poAzulColor = new Azul.Color(1, 1, 1); Debug.Assert(this.poAzulColor != null); // Prep Sprite this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, this.poAzulColor); Debug.Assert(this.poAzulSprite != null); //grab data from the Azul Sprite this.x = poAzulSprite.x; this.y = poAzulSprite.y; this.sx = poAzulSprite.sx; this.sy = poAzulSprite.sy; this.angle = poAzulSprite.angle; }
//private Name colName; public CollisionSprite() : base() { lineWidth = 1.0f; line = null; rect = null; }
public Image() { this.name = Name.Uninitialized; this.pTexture = null; this.poImageRect = new Azul.Rect(); Debug.Assert(poImageRect != null); }
public override void Execute(float deltaTime) { // TODO add parameters for border edges [Left, Right, Top, Bottom] for when to reset movement // TODO Probably need to create sub-commands for different types of movement? spriteProxyRect = this.pGameObject.GetSpriteProxy().GetSpriteScreenRect(); spriteProxyHalfWidth = spriteProxyRect.width / 2.0f; // + ( (deltaX > 0.0f) ? spriteProxyHalfWidth : (-1.0f * spriteProxyHalfWidth)) this.currX = this.pGameObject.GetX() + this.deltaX; this.currY = this.pGameObject.GetY() + this.deltaY; // If past window edge, change directions if ((this.currX + spriteProxyHalfWidth) > 896.0f) { deltaX = (-1.0f * deltaX); currX = 896.0f - spriteProxyHalfWidth; } else if ((this.currX + -(spriteProxyHalfWidth)) < 0.0f) { deltaX = (-1.0f * deltaX); currX = 0.0f + spriteProxyHalfWidth; } // Update X, Y in Sprite this.pGameObject.SetX(this.currX); this.pGameObject.SetY(this.currY); // Add itself back to timer TimerManager.Add(TimeEvent.Name.SpriteMovement, this, deltaTime); }
// // Constructor // public Collider() { this.collisionSprite = null; this.colliderBoundary = new Azul.Rect(); this.gameObjectId = 0u; this.color = Colors.Green; }
//--------------------------------------------------------------------------------------------------------- // Constructor //--------------------------------------------------------------------------------------------------------- public Image() : base() { this.pTextureRect = new Azul.Rect(); Debug.Assert(this.pTextureRect != null); this.Clean(); }
public Image() : base() { tex = null; texCoords = null; index = Index.Index_Null; name = ImageEnum.Not_Initialized; }
//EDIT THE FOLLOWING METHODS--------------------- public Glyph() : base() { this.name = Name.Blank; this.pTexture = null; this.pSubRect = new Azul.Rect(); this.key = 0; }
public Font() : base() { this.name = FontName.Uninitialized; this.pTexture = null; this.pAzulRect = new Azul.Rect(); this.key = 0; }
public Image() : base() { this.poRect = new Azul.Rect(); Debug.Assert(this.poRect != null); this.Clear(); }
public static Image Add(Image.Name name, Texture.Name texture, Azul.Rect poRect) { Image image = (Image)instance.AddToFront(); Texture pTexture = TextureMan.Find(texture); image.Initialize(name, pTexture, poRect); return(image); }
public Sprite() : base() { this.pAzulSprite = new Azul.Sprite(); this.pScreenRect = new Azul.Rect(); this.pColor = new Azul.Color(1.0f, 1.0f, 1.0f); this.pImage = new Image(); }
public static SpriteBox Add(SpriteBaseName name, Azul.Rect azulRect) { SpriteBoxManager spriteBoxMan = SpriteBoxManager.GetInstance(); SpriteBox spriteBox = (SpriteBox)spriteBoxMan.BaseAdd(); spriteBox.Set(name, azulRect.x, azulRect.y, azulRect.width, azulRect.height); return(spriteBox); }
public GameObject(GAMEOBJECT_TYPE _type, Azul.Rect textureRect, Azul.Rect screenRect, Azul.Texture text, Azul.Color c) { type = _type; color = c; pSprite = new Azul.Sprite(text, textureRect, screenRect, color); pScreenRect = screenRect; id = IDNUM++; alive = true; }
//---------------------------------------------------------------------------------- // Constructor //---------------------------------------------------------------------------------- public Image(Name myName, Texture pSrcTexture, Azul.Rect pSubRect) { Debug.Assert(pSrcTexture != null); Debug.Assert(pSubRect != null); this.name = myName; this.pTexture = pSrcTexture; this.poRect = new Azul.Rect(pSubRect); }
public Image() : base() { // first calls the super class constructor. this.name = Name.Uninitialized; this.pTexture = null; this.poRect = new Azul.Rect(); Debug.Assert(this.poRect != null); }
public void setDimension(Azul.Rect r) { this.poRect.x = r.x; this.poRect.y = r.y; this.poRect.width = r.width; this.poRect.height = r.height; Azul.Rect tmpRect = new Azul.Rect(r.x, r.y, r.width, r.height); this.poAzulSpriteBox.SwapScreenRect(tmpRect); }
// parameterized constructor public Image(ImageName imageName, Texture imageTex, Azul.Rect imageRect) { Debug.Assert(imageTex != null); Debug.Assert(imageRect != null); this.setImageName(imageName); this.setImageRect(imageRect); this.setImageTexture(imageTex); }
void SpawnExplosionParticle(GameObject obj) { Vec2 pos = obj.GetPixelPosition(); Azul.Rect dest = new Azul.Rect(pos.X, pos.Y, 30, 30); AnimationParticle part = new AnimationParticle(new Azul.Rect(0, 0, 86, 70), dest, explosionText, new Azul.Color(1, 1, 1)); GameManager.AddGameObject(part); }
public void set(SpriteEnum sName, Index index, Azul.Color color, float x, float y, float width, float height) { //Debug.Assert(color != null); this.setBase(sName, index, 0.0f, 0.0f); lineWidth = 1.0f; this.sprColor = color; rect = new Azul.Rect(x, y, width, height); line = new Azul.Line(this.lineWidth, this.sprColor, x, y, x + width, y + height); }
public ProxyCollisionSprite(Azul.Color color, SpriteEnum name, Index index) : base() { Debug.Assert(color != null); //Debug.Assert(name.Equals(SpriteEnum.Collision)); //Debug.Assert(index.Equals(Index.Index_Null)); setBase(name, index, 0.0f, 0.0f); colSprite = CollisionSpriteManager.find(SpriteEnum.Collision, Index.Index_Null); grid = new Azul.Rect(); gridColor = color; }
public CollisionObject(SpriteEnum name, Index index, Azul.Color color) { if (!name.Equals(SpriteEnum.Null)) { GameSprite spr = GameSpriteManager.find(name); this.colSpr = new ProxyCollisionSprite(color, name, index); this.colBounds = new Azul.Rect(spr.Rect.x, spr.Rect.y, spr.Rect.w, spr.Rect.h); this.colBounds.x -= colBounds.w / 2; this.colBounds.y += colBounds.h / 2; } else { this.colSpr = new ProxyCollisionSprite(color, name, index); this.colBounds = new Azul.Rect(); } }
public void setRect(Azul.Rect newRect) { this.colBounds = newRect; //this.colBounds.x = newRect.x - newRect.w / 2; //this.colBounds.y = newRect.y + newRect.h / 2; //this.colBounds.w = newRect.w; //this.colBounds.h = newRect.h; }
public BottomWall(Name name, Index index) : base(name, SpriteEnum.Null, index, new Azul.Color(0f, 0f, 0f), new Azul.Color(0f, 0f, 1f), 0f, 15f) { wallRect = new Azul.Rect(0, 15, 1024.0f, 15.0f); }
public RightWall(Name name, Index index) : base(name, SpriteEnum.Null, index, new Azul.Color(0f, 0f, 0f), new Azul.Color(0.0f, 1.0f, 0.0f), 1024.0f, 896.0f) { this.index = index; wallRect = new Azul.Rect(1009.0f, 896.0f, 15.0f, 896.0f); }
public TopWall(Name name, Index index) : base(name, SpriteEnum.Null, index, new Azul.Color(0f, 0f, 0f), new Azul.Color(0.0f, 0.5f, 1.0f), 0.0f, 896.0f) { wallRect = new Azul.Rect(0.0f, 896.0f, 1024.0f, 15.0f); }
public void set(SpriteEnum sName, Index index, ImageEnum iName, float x, float y, float width, float height) { base.setBase(sName, index, x, y); this.img = ImageManager.find(iName); this.sprite = new Azul.Sprite2D(this.img.getTexture(), this.img.TexCoords, new Azul.Rect(x, y, width, height)); this.sprRect = new Azul.Rect(x, y, width, height); angle = 0; scaleX = this.sprite.sx; scaleY = this.sprite.sy; }
public void setImage(ImageEnum iName, TexEnum tName, float x, float y, float width, float height) { name = iName; tex = TextureManager.find(tName); texCoords = new Azul.Rect(x, y, width, height); }
public LeftWall(Name name, Index index) : base(name, SpriteEnum.Null, index, new Azul.Color(0f, 0f, 0f), new Azul.Color(0.0f, 1.0f, 0.0f), 0.0f, 896.0f) { this.wallRect = new Azul.Rect(0.0f, 896.0f, 15.0f, 896.0f); }