/// <summary> /// balról jobbra, alulról felfelé /// </summary> /// <param name="world"></param> /// <param name="delta"></param> /// <param name="wallRightX"></param> /// <returns></returns> protected bool hasLeftWall2(cWorld world, float delta, out float wallRightX) { wallRightX = 0.0f; float predictedPosX = position.X + delta; Vector2f oldTopLeft = new Vector2f(position.X, position.Y); Vector2f newTopLeft = new Vector2f(predictedPosX - 1, position.Y); Vector2f newBottomLeft = new Vector2f(newTopLeft.X, newTopLeft.Y + bounds.dims.Y - 2.0f); int tileEndX = world.ToMapPos(newTopLeft).X - 1; int tileBeginX = Math.Max(world.ToMapPos(oldTopLeft).X, tileEndX); int tileBeginY = world.ToMapPos(newBottomLeft).Y; int tileEndY = world.ToMapPos(newTopLeft).Y; for (int tileIndexX = tileBeginX; tileIndexX > tileEndX; --tileIndexX) { for (int tileIndexY = tileBeginY; tileIndexY >= tileEndY; --tileIndexY) { //world.GetCurrentLevel().GetTileAtXY(tileIndexX, tileIndexY).PlayerCollidable = false; if (world.GetCurrentLevel().GetTileAtXY(tileIndexX, tileIndexY).Type == TileType.WALL) /*world.isRectOnWall()*/ { //world.GetCurrentLevel().GetTileAtXY(tileIndexX, tileIndexY).PlayerCollidable = true; wallRightX = (int)(tileIndexX * Constants.TILE_SIZE + Constants.TILE_SIZE + world.WorldBounds.topLeft.X); return(true); } } } return(false); }
protected bool hasRightWall2(cWorld world, float delta, out float wallLeftX) { wallLeftX = 0.0f; float predictedPosX = position.X + Bounds.dims.X + delta; Vector2f oldTopRight = new Vector2f(position.X + Bounds.dims.X, position.Y); Vector2f newTopRight = new Vector2f(predictedPosX, position.Y); Vector2f newBottomRight = new Vector2f(newTopRight.X, newTopRight.Y + Bounds.dims.Y - 2.0f); int tileEndX = world.ToMapPos(newTopRight).X + 1; int tileBeginX = Math.Min(world.ToMapPos(oldTopRight).X, tileEndX); int tileBeginY = world.ToMapPos(newTopRight).Y; int tileEndY = world.ToMapPos(newBottomRight).Y; // changed to handle right walking between walls when falling for (int tileIndexX = tileBeginX; tileIndexX < tileEndX; ++tileIndexX) { for (int tileIndexY = tileBeginY; tileIndexY <= tileEndY; ++tileIndexY) { //world.GetCurrentLevel.GetTileAtXY(tileIndexX, tileIndexY).PlayerCollidable = false; if (world.CurrentLevel.GetTileAtXY(tileIndexX, tileIndexY).Type == TileType.WALL) /*world.isRectOnWall()*/ { //world.GetCurrentLevel.GetTileAtXY(tileIndexX, tileIndexY).PlayerCollidable = true; wallLeftX = (int)(tileIndexX * Constants.TILE_SIZE); // + world.WorldBounds.topLeft.X return(true); } } } return(false); }
public bool checkCollisionWithWorld(cWorld world, ref Vector2f intersectionOut) { Vector2i posA = new Vector2i((int)this.lastPosition.X, (int)this.lastPosition.Y); //world.ToMapPos(this.lastPosition); Vector2i posB = new Vector2i((int)this.position.X, (int)this.position.Y); // world.ToMapPos(this.Position); bool collided = false; Vector2f intersectionPoint = new Vector2f(0.0f, 0.0f); AppMath.Raytrace(posA.X, posA.Y, posB.X, posB.Y, (x, y) => { collided = world.IsWallAtPos(new Vector2f(x, y)); //world.GetCurrentLevel.IsObstacleAtPos(x, y); intersectionPoint.X = x; // = world.ToWorldPos(new Vector2i(x, y)); intersectionPoint.Y = y; return(collided); } ); intersectionOut.X = intersectionPoint.X; intersectionOut.Y = intersectionPoint.Y; return(collided); }
private void updateParticle2(float step_time, Particle p, cWorld world) { p.Vel.Y += (Constants.GRAVITY * 40.0f * (step_time * step_time)); // p.Vel.X *= p.SlowDown; // p.Vel.Y *= p.SlowDown; AppMath.Vec2Truncate(ref p.Vel, p.MaxSpeed); //world.collideParticleSAT(p, step_time, false); //p.Heading = cAppMath.Vec2NormalizeReturn(p.Vel); p.LastPos = p.Pos; p.Pos.X += p.Vel.X * step_time; p.Pos.Y += p.Vel.Y * step_time; if (!AppMath.Vec2IsZero(p.Vel)) { p.Heading = AppMath.Vec2NormalizeReturn(p.Vel); p.Rotation = (float)AppMath.GetAngleOfVector(p.Heading); } world.collideParticleRayTrace(p, step_time); p.Opacity -= p.Fade * step_time; }
protected virtual void updateX(float step_time, cWorld world) { acceleration.X = force.X; velocity.X += acceleration.X * step_time; if (acceleration.X < 0.0f) { velocity.X = AppMath.Max <float>(velocity.X, -this.maxWalkSpeed); } else if (acceleration.X > 0.0f) { velocity.X = AppMath.Min <float>(velocity.X, this.maxWalkSpeed); } else // if (isOnGround) { velocity.X = isOnGround ? velocity.X * Constants.GROUND_SLOW_DOWN_FACTOR : velocity.X * Constants.AIR_SLOW_DOWN_FACTOR; } velocity.X = Math.Abs(velocity.X) <= 0.05f ? 0.0f : velocity.X; float delta = velocity.X * step_time; if (delta <= 0.0f) { float wallRightX; if (hasLeftWall2(world, delta, out wallRightX)) { position.X = wallRightX; velocity.X = 0.0f; } else { position.X += delta; } } else { float wallLeftX; if (hasRightWall2(world, delta, out wallLeftX)) { position.X = wallLeftX - Bounds.dims.X; velocity.X = 0.0f; } else { position.X += delta; } } }
protected virtual void updateY(float step_time, cWorld world) { float gravity = (isJumpActive && velocity.Y < 0.0f) ? Constants.JUMP_GRAVITY : Constants.GRAVITY; force.Y += gravity; acceleration.Y = force.Y; velocity.Y += acceleration.Y * step_time; //velocity.Y = Math.Min(velocity.Y + gravity * step_time, Constants.MAX_Y_SPEED); velocity.Y = Math.Min(velocity.Y, Constants.MAX_Y_SPEED); float groundY; float delta = velocity.Y * step_time; if (delta >= 0.0f) { if (hasGround2(world, delta, out groundY)) { position.Y = groundY - Bounds.dims.Y; isOnGround = true; velocity.Y = 0.0f; // bouncing //velocity.Y = Math.Abs(velocity.Y) <= 65.0f ? 0.0f : -(velocity.Y * 0.8f); } else { isOnGround = false; position.Y += delta; } } else { float bottomY; if (hasCeiling(world, delta, out bottomY)) { position.Y = bottomY + 1.0f; //- Bounds.dims.Y; velocity.Y = 0.0f; } else { isOnGround = false; position.Y += delta; } } //float delta = (velocity.Y * step_time); }
private void CreateWorld() { _world = new cWorld(); cTile.TileSizeInPixels = 8.0f; Animal.TileSizeInPixels = 8.0f; IWorldInCreation worldInCreation = _world as IWorldInCreation; WorldGeneration.WorldGenerator.CreateWorld(ref worldInCreation, GameWorldCreationProperties); }
public override void Update(float step_time) { cWorld world = particleManager.Scene.World; for (int i = 0; i < pool.CountActive; ++i) { Particle p = pool.get(i); if (!p.Intersects) { /* * p.Dims.Y += p.ScaleSpeed * step_time; //+= * p.Dims.y += p.ScaleSpeed * step_time; //+= */ cAppMath.Vec2Truncate(ref p.Vel, p.MaxSpeed * 1.5f); p.Vel.Y += (Constants.GRAVITY * 40.0f * (step_time * step_time)); p.Vel.X *= p.SlowDown; p.Vel.Y *= p.SlowDown; //p.Heading = cAppMath.Vec2NormalizeReturn(p.Vel); p.LastPos = p.Pos; p.Pos.X += p.Vel.X * step_time; p.Pos.Y += p.Vel.Y * step_time; if (!cAppMath.Vec2IsZero(p.Vel)) { p.Heading = cAppMath.Vec2NormalizeReturn(p.Vel); p.Rotation = (float)cAppMath.GetAngleOfVector(p.Heading); } world.collideParticleRayTrace(p, step_time); } p.Opacity -= p.Fade * step_time; if (p.Opacity <= 0.0f) { p.Opacity = 0.0f; pool.deactivate(i); } p.Color.A = (byte)p.Opacity; } }
public cTileMapRenderer(cWorld world) { this.world = world; this.drawTileLayers = new List <cTileLayer>(); this.tileSetTexture = world.CurrentLevel.TilesetTexture; drawTileBounds = new AABB(); this.setupLayers(); // textureOfTiles = new RenderTexture((uint)m_WorldBounds.dims.X, (uint)m_WorldBounds.dims.Y); //(windowSize.X, windowSize.Y); // textureOfTiles.SetActive(true); }
protected virtual void updateMovement(float step_time) { cWorld world = pscene.World; lastPosition.X = position.X; lastPosition.Y = position.Y; updateX(step_time, world); updateY(step_time, world); Bounds.SetPosByTopLeft(position); this.hitCollisionRect.SetPosByTopLeft(position); this.force.X = 0.0f; this.force.Y = 0.0f; }
protected bool hasCeiling(cWorld world, float delta, out float bottomY) { bottomY = 0.0f; float predictedPosY = position.Y + delta; Vector2f oldTopLeft = new Vector2f(position.X, position.Y); Vector2f newTopLeft = new Vector2f(position.X, predictedPosY); Vector2f newTopRight = new Vector2f(newTopLeft.X + Bounds.dims.X - 2.0f, newTopLeft.Y); int endY = world.ToMapPos(oldTopLeft).Y; //mMap.GetMapTileYAtPoint(newBottomLeft.y); int begY = Math.Min(world.ToMapPos(newTopLeft).Y, endY); int dist = Math.Max(Math.Abs(endY - begY), 1); int tileIndexX; for (int tileIndexY = begY; tileIndexY <= endY; ++tileIndexY) { var topLeft = AppMath.Interpolate(newTopLeft, oldTopLeft, (float)Math.Abs(endY - tileIndexY) / dist); var topRight = new Vector2f(topLeft.X + Bounds.dims.X - 1, topLeft.Y); for (var checkedTile = topLeft; ; checkedTile.X += Constants.TILE_SIZE) { checkedTile.X = Math.Min(checkedTile.X, topRight.X); tileIndexX = world.ToMapPos(checkedTile).X; if (world.CurrentLevel.GetTileAtXY(tileIndexX, tileIndexY).Type == TileType.WALL) { bottomY = (((float)tileIndexY) * Constants.TILE_SIZE + world.WorldBounds.topLeft.Y + Constants.TILE_SIZE); return(true); } if (checkedTile.X >= topRight.X) { break; } } } return(false); }
public override void Update(float step_time) { cWorld world = particleManager.Scene.World; for (int i = 0; i < pool.CountActive; ++i) { Particle p = pool.get(i); this.updateParticle1(step_time, p, world); if (p.Opacity <= 0.0f || p.Dims.X <= 0.0f || p.Dims.Y <= 0.0f) { p.Opacity = 0.0f; pool.deactivate(i); } p.Color.A = (byte)p.Opacity; } }
protected void checkCollisionWithWorld(float step_time) { cWorld world = Scene.World; if (false == pulling) { pscene.World.collideSAT(this, step_time); /* * // check collisions with world * List<AABB> wallsPossibleColliding = world.getCollidableBlocks(Bounds); * * // we must check this, because we need to iterate through the possible * // colliding tiles from other direction according to this condition * if (velocity.X > 0.0f) * { * for (int i = 0; i < wallsPossibleColliding.Count; ++i) * { * cGameObject wallObject = cGameObject.MakeWall(wallsPossibleColliding[i]); * if (cSatCollision.checkAndResolve(this, wallObject, step_time, true)) * { * return; * } * } * } * else * { * // we have to iterate from "end" to the "start" in order to have the last colliding block below us * for (int i = wallsPossibleColliding.Count-1; i >= 0; --i) * { * cGameObject wallObject = cGameObject.MakeWall(wallsPossibleColliding[i]); * if (cSatCollision.checkAndResolve(this, wallObject, step_time, true)) * { * return; * } * * } * } */ } }
/// <summary> /// Main update protocol. /// </summary> /// <param name="step_time"></param> /// <param name="p"></param> /// <param name="world"></param> private void updateParticle1(float step_time, Particle p, cWorld world) { // Particle's update code comes here. p.Dims.X += p.ScaleSpeed * step_time; //+= p.Dims.Y += p.ScaleSpeed * step_time; //+= if (AppMath.Vec2Length(p.Dims) < 0.5f) { p.Dims.X = 0.0f; p.Dims.Y = 0.0f; } p.Vel.Y += (Constants.GRAVITY * 40.0f * (step_time * step_time)); p.Vel.X *= p.SlowDown; p.Vel.Y *= p.SlowDown; AppMath.Vec2Truncate(ref p.Vel, p.MaxSpeed * 1.5f); // world.collideParticleSAT(p, step_time, false); //p.Heading = cAppMath.Vec2NormalizeReturn(p.Vel); p.LastPos = p.Pos; p.Pos.X += p.Vel.X * step_time; p.Pos.Y += p.Vel.Y * step_time; if (!AppMath.Vec2IsZero(p.Vel)) { p.Heading = AppMath.Vec2NormalizeReturn(p.Vel); p.Rotation = (float)AppMath.GetAngleOfVector(p.Heading); } world.collideParticleRayTrace(p, step_time); p.Opacity -= p.Fade * step_time; }
protected void checkCollisionWithWorld(float step_time) { cWorld world = Scene.World; if (false == pulling) { // check collisions with world List <cAABB> wallsPossibleColliding = world.getCollidableBlocks(Bounds); // we must check this, because we need to iterate through the possible // colliding tiles from other direction according to this condition if (velocity.X > 0.0f) { for (int i = 0; i < wallsPossibleColliding.Count; i++) { cGameObject wallObject = cGameObject.MakeWall(wallsPossibleColliding[i]); if (cSatCollision.checkAndResolve(this, wallObject, step_time, true)) { break; } } } else { // we have to iterate from "end" to the "start" in order to have the last colliding block below us for (int i = wallsPossibleColliding.Count - 1; i >= 0; i--) { cGameObject wallObject = cGameObject.MakeWall(wallsPossibleColliding[i]); if (cSatCollision.checkAndResolve(this, wallObject, step_time, true)) { break; } } } } }
protected bool hasGround2(cWorld world, float delta, out float groundY) { groundY = 0.0f; float predictedPosY = position.Y + delta; Vector2f oldBottomRight = new Vector2f(position.X + bounds.halfDims.X, position.Y + bounds.dims.Y); Vector2f oldBottomLeft = new Vector2f(position.X, position.Y + bounds.dims.Y); Vector2f newBottomLeft = new Vector2f(oldBottomLeft.X, predictedPosY + bounds.dims.Y); Vector2f newBottomRight = new Vector2f(newBottomLeft.X + bounds.halfDims.X, newBottomLeft.Y); int tileEndX = world.ToMapPos(oldBottomLeft).X + 1; int tileBeginX = Math.Min(world.ToMapPos(oldBottomLeft).X, tileEndX); int tileBeginY = world.ToMapPos(oldBottomLeft).Y; int tileEndY = world.ToMapPos(newBottomLeft).Y; for (int tileIndexY = tileBeginY; tileIndexY <= tileEndY; ++tileIndexY) { for (int tileIndexX = tileBeginX; tileIndexX <= tileEndX; ++tileIndexX) { if (world.GetCurrentLevel().GetTileAtXY(tileIndexX, tileIndexY).Type == TileType.WALL) /*world.isRectOnWall()*/ { //world.GetCurrentLevel().GetTileAtXY(tileIndexX, tileIndexY).PlayerCollidable = true; world.GetCurrentLevel().GetTileAtXY(tileIndexX, tileIndexY).PlayerCollidable = true; groundY = (int)(tileIndexY * Constants.TILE_SIZE + world.WorldBounds.topLeft.Y); return(true); } } } return(false); }
protected bool hasGround2(cWorld world, float delta, out float groundY) { groundY = 0.0f; float predictedPosY = position.Y + delta; Vector2f oldBottomRight = new Vector2f(position.X + Bounds.halfDims.X, position.Y + Bounds.dims.Y); Vector2f oldBottomLeft = new Vector2f(position.X, position.Y + Bounds.dims.Y); Vector2f newBottomLeft = new Vector2f(oldBottomLeft.X, predictedPosY + Bounds.dims.Y); Vector2f newBottomRight = new Vector2f(newBottomLeft.X + Bounds.halfDims.X, newBottomLeft.Y); // int tileBeginX = Math.Min(world.ToMapPos(oldBottomLeft).X, tileEndX); int tileBeginX = world.ToMapPos(oldBottomLeft).X - 1; int tileEndX = world.ToMapPos(newBottomRight).X + 1; int tileBeginY = world.ToMapPos(oldBottomLeft).Y - 1; int tileEndY = world.ToMapPos(newBottomLeft).Y + 1; if (this.velocity.X < 0.0f) { for (int tileIndexY = tileBeginY; tileIndexY <= tileEndY; ++tileIndexY) { for (int tileIndexX = tileBeginX; tileIndexX < tileEndX; ++tileIndexX) { if (tileCollision(tileIndexX, tileIndexY, out groundY)) { return(true); } } } } else { for (int tileIndexY = tileBeginY; tileIndexY <= tileEndY; ++tileIndexY) { for (int tileIndexX = tileEndX; tileIndexX > tileBeginX; --tileIndexX) { if (tileCollision(tileIndexX, tileIndexY, out groundY)) { return(true); } } } } //if (world.CurrentLevel.GetTileAtXY(tileIndexX, tileIndexY).Type == TileType.WALL) /*world.isRectOnWall()*/ /* * { * //world.GetCurrentLevel.GetTileAtXY(tileIndexX, tileIndexY).PlayerCollidable = true; * * world.CurrentLevel.GetTileAtXY(tileIndexX, tileIndexY).PlayerCollidable = true; * groundY = (int)(tileIndexY * Constants.TILE_SIZE + world.WorldBounds.topLeft.Y); * return true; * } */ return(false); }
protected bool hasGround(cWorld world, float delta, out float groundY) { /*var oldCenter = lastPosition; * var center = position;*/ groundY = 0.0f; float predictedPosY = position.Y + delta; /* * Vector2f up = new Vector2f(0, -1); * Vector2f bottom = new Vector2f(0, 1); * Vector2f left = new Vector2f(-1, 0); * Vector2f right = new Vector2f(1, 0);*/ Vector2f oldBottomLeft = new Vector2f(position.X, position.Y + Bounds.dims.Y); Vector2f newBottomLeft = new Vector2f(position.X, predictedPosY + Bounds.dims.Y); Vector2f newBottomRight = new Vector2f(newBottomLeft.X + Bounds.dims.X, newBottomLeft.Y); int endY = world.ToMapPos(newBottomLeft).Y; //mMap.GetMapTileYAtPoint(newBottomLeft.y); int begY = Math.Max(world.ToMapPos(oldBottomLeft).Y - 1, endY); int dist = Math.Max(Math.Abs(endY - begY), 1); int tileIndexX; for (int tileIndexY = begY; tileIndexY <= endY; ++tileIndexY) { var bottomLeft = AppMath.Interpolate(newBottomLeft, oldBottomLeft, (float)Math.Abs(endY - tileIndexY) / dist); var bottomRight = new Vector2f(bottomLeft.X + Bounds.dims.X - 1.0f, bottomLeft.Y); // -1, -2.0f for (var checkedTile = bottomLeft; ; checkedTile.X += Constants.TILE_SIZE) { checkedTile.X = Math.Min(checkedTile.X, bottomRight.X); tileIndexX = world.ToMapPos(checkedTile).X; //world.GetCurrentLevel.GetTileAtXY(tileIndexX, tileIndexY).PlayerCollidable = true; groundY = (int)((float)tileIndexY * Constants.TILE_SIZE + world.WorldBounds.topLeft.Y); TileType tile = world.CurrentLevel.GetTileAtXY(tileIndexX, tileIndexY).Type; if (tile == TileType.WALL) { isOnOnewWayPlatform = false; return(true); } else if (tile == TileType.ONEWAY_PLATFORM && position.Y <= groundY - Bounds.dims.Y) { isOnOnewWayPlatform = true; return(true); } if (checkedTile.X >= bottomRight.X) { /*if(isOnOnewWayPlatform) * return true;*/ break; } } } return(false); }
public override void Update(float step_time) { cWorld world = particleManager.Scene.World; /* * if(emiting && this.emitTimer.isReady()) * { * // initParticle(); * remaining -= 1; * emiting = remaining > 0; * } */ for (int i = 0; i < pool.CountActive; ++i) { Particle p = pool.get(i); // p.Vel.Y += (Constants.GRAVITY*30 * (step_time * step_time)); p.Vel.X *= p.SlowDown; p.Vel.Y *= p.SlowDown; AppMath.Vec2Truncate(ref p.Vel, p.MaxSpeed); //world.collideParticleSAT(p, step_time); //p.Heading = cAppMath.Vec2NormalizeReturn(p.Vel); Vector2u uSize = this.renderStates.Texture.Size; p.Scale -= p.ScaleSpeed * step_time; p.Dims = new Vector2f(uSize.X * p.Scale, uSize.Y * p.Scale); p.LastPos = p.Pos; p.Pos.X += p.Vel.X * step_time; p.Pos.Y += p.Vel.Y * step_time; if (!AppMath.Vec2IsZero(p.Vel)) { p.Heading = AppMath.Vec2NormalizeReturn(p.Vel); // p.Rotation = (float)cAppMath.GetAngleOfVector(p.Heading); } world.collideParticleRayTrace(p, step_time, true, false); p.Opacity -= p.Fade * step_time; if (p.Opacity <= 0.0f || p.Scale <= 0.0f) { p.Opacity = 0.0f; p.Scale = 0.0f; p.Life -= 1.0f; if (p.Life <= 0.0f) { pool.deactivate(i); } else { this.reinit(p); } } p.Color.A = (byte)p.Opacity; } }
public override void Enter() { this.resourceAssets.LoadResources(Constants.FONT_NAMES, Constants.TEXTURES_NAMES, Constants.SOUND_NAMES); cAnimationAssets.LoadAnimations(this.resourceAssets); BulletBreed.Init(this.resourceAssets); PickupEffects.InitPickupEffects(this.resourceAssets); camera = new Camera(new View(new Vector2f(appControllerRef.WindowSize.X / 2.0f, appControllerRef.WindowSize.Y / 2.0f), appControllerRef.WindowSize)); camera.Zoom = 0.6f; // 0.6f; appControllerRef.MainWindow.SetView(camera.View); /* * Vector2f viewSize = new Vector2f(appController.MainWindow.Size.X, appController.MainWindow.Size.Y); * * m_View.Size = new Vector2f(viewSize.X, viewSize.Y); * m_View.Center = new Vector2f(viewSize.X / 2.0f, viewSize.Y / 2.0f); * m_View.Viewport = new FloatRect(0.0f, 0.0f, 1.0f, 1.0f); * m_View.Zoom(0.6f); //0.6f * * viewRect = new AABB(); * viewRect.SetDims(m_View.Size); */ worldEnvironment = new cEnvironment(); // Constants.LIGHTMAP_COLOR lightMap = new cLightSystem(Constants.LIGHTMAP_COLOR, this.resourceAssets); //((uint)m_World.WorldBounds.dims.X, (uint)m_World.WorldBounds.dims.Y, Constants.LIGHTMAP_COLOR); gameWorld = new cWorld(this, appControllerRef.MainWindow.Size); gameWorld.InitLevel(); //lightMap.Create((uint)m_World.WorldBounds.dims.X, (uint)m_World.WorldBounds.dims.Y); lightMap.Create(appControllerRef.MainWindow.Size.X, appControllerRef.MainWindow.Size.Y); lightMap.loadLightsFromTmxMap(gameWorld.CurrentLevel.GetTmxMap()); this.staticTexture = new RenderTexture((uint)gameWorld.WorldBounds.dims.X, (uint)gameWorld.WorldBounds.dims.Y); this.staticTexture.SetActive(true); this.staticTexture.Clear(new Color(0, 0, 0, 0)); //this.staticTexture.SetView(m_View); Vector2f playerStart = new Vector2f(gameWorld.LevelStartRegion.center.X, gameWorld.LevelStartRegion.rightBottom.Y); playerStart.X -= Constants.CHAR_FRAME_WIDTH / 2.0f; playerStart.Y -= Constants.CHAR_FRAME_HEIGHT; player = new cPlayer(this, playerStart); entityPool = new GameObjectGrid(this, gameWorld.WorldBounds.dims, player); entityPool.InitLevelEntites(World.CurrentLevel); //vizekhez adunk fényt /* * List<cWaterBlock> waterBlocks = m_World.GetWaterBlocks(); * * foreach (cWaterBlock wb in waterBlocks) * { * cLight waterLight = new cLight(); //víz blokkokhoz adunk fényt, mert jól néz ki * waterLight.Pos = new Vector2f(wb.Area.center.X, wb.Area.topLeft.Y+Constants.TILE_SIZE/2.0f); * waterLight.Radius = (wb.Area.dims.X + wb.Area.dims.Y) * 0.8f; * waterLight.Bleed = 0.00001f; // 0.00001f; * waterLight.LinearizeFactor = 0.95f; * waterLight.Color = new Color(41,174,232); // 96,156,164 * lightMap.AddStaticLight(waterLight); * } * * //háttér, környezeti tárgyak megjelenítése * worldEnvironment.SetWaterBlocks(waterBlocks); */ this.particleManager = new cParticleManager(this); this.effectSystem = new EffectSystem(); // lightMap.renderStaticLightsToTexture(); gameActions = new Queue <Action>(50); Listener.GlobalVolume = 80; Listener.Direction = new Vector3f(1.0f, 0.0f, 0.0f); ShakeScreen.Init(camera.ActualPosition); //Pálya idő start levelTimer.Start(); }