Beispiel #1
0
 public Boolean collides(BoundingBox2D boundingBox)
 {
     if (new Rectangle((int)(position.X), (int)(position.Y), (int)size.X, (int)size.Y).Intersects(new Rectangle((int)boundingBox.position.X, (int)boundingBox.position.Y, (int)boundingBox.size.X, (int)boundingBox.size.Y)))
         return true;
     return false;
 }
Beispiel #2
0
        public GamePlayer(Vector2 position, Vector2 size, World world)
            : base(position, size, world)
        {
            speed = 7 * 20;
            jumpEnergy = 150 * 20;
            _currentChunkPosition = new Vector2((int)position.X / (World.chunkSizeX * World.blockSize),(int)position.Y / (World.chunkSizeX * World.blockSize));

            _boundingBox = new BoundingBox2D(this, size);
        }
Beispiel #3
0
 public GameItem(Vector2 position, Vector2 size , Texture2D texture, World world)
     : base(position, size, world)
 {
     this.texture = texture;
     _boundingBox = new BoundingBox2D(this, size);
     world.allChunks[(int)_currentChunkPosition.X, (int)_currentChunkPosition.Y].items.Add(this);
 }