Game Development Reference
In-Depth Information
public void Update(double elapsedTime)
{
// _enemyList.ForEach(x = > x.Update(elapsedTime)); < - Remove this line
_enemyManager.Update(elapsedTime);
// Code omitted
public void Render(Renderer renderer)
{
_background.Render(renderer);
_backgroundLayer.Render(renderer);
//_enemyList.ForEach(x = > x.Render(renderer)); < - remove this line
_enemyManager.Render(renderer);
Run the program now. Shooting the enemy a couple of times will make it
explode and disappear. This has started to become much more game-like. The
most obvious failings at the moment are that there is only one enemy and it
doesn't move.
Level Definitions
The current level lasts for 30 seconds and has one enemy at the start—this isn't a
very interesting level. If there was some system for defining levels, then it would
be easier to add a bit more excitement to this level. The level definition is a list of
enemies to spawn at certain times. A level definition will therefore need
some way to define enemies; the following code is a good starting point. The
EnemyDef class should be added to the Engine project.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Engine;
namespace Shooter
{
class EnemyDef
{
public string EnemyType { get; set; }
public Vector StartPosition { get; set; }
public double LaunchTime { get; set; }
 
Search WWH ::




Custom Search