Développement XNA pour la XBox et le PC
52
namespace PremierProjetXNA
{
class Human : Sprite
{
string name;
int health;
public Human(Vector2 position, string name, int health)
: base(position)
{
this.name = name;
this.health = health;
}
}
}
Qu’ont un mage et un guerrier en commun ? À l’origine il s’agit bien évidemment
d’humains… Encore que tout amateur de jeux de rôles vous dira qu’un orque ou encore
un elfe peut tout aussi bien accomplir cette tâche. Là encore, la notion d’héritage peut
s’appliquer…
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace PremierProjetXNA
{
class Wizard : Human
{
int intelligence;
public Wizard(Vector2 position, string name, int health, int intelligence)
: base(position, name, health)
{
this.intelligence = intelligence;
}
}
}
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace PremierProjetXNA
{
class Warrior : Human
{
int strength;
public Warrior(Vector2 position, string name, int health, int strength)
: base(position, name, health)
{
this.strength = strength;
}
}
}
=Labat FM.book Page 52 Vendredi, 19. juin 2009 4:01 16
52
namespace PremierProjetXNA
{
class Human : Sprite
{
string name;
int health;
public Human(Vector2 position, string name, int health)
: base(position)
{
this.name = name;
this.health = health;
}
}
}
Qu’ont un mage et un guerrier en commun ? À l’origine il s’agit bien évidemment
d’humains… Encore que tout amateur de jeux de rôles vous dira qu’un orque ou encore
un elfe peut tout aussi bien accomplir cette tâche. Là encore, la notion d’héritage peut
s’appliquer…
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace PremierProjetXNA
{
class Wizard : Human
{
int intelligence;
public Wizard(Vector2 position, string name, int health, int intelligence)
: base(position, name, health)
{
this.intelligence = intelligence;
}
}
}
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace PremierProjetXNA
{
class Warrior : Human
{
int strength;
public Warrior(Vector2 position, string name, int health, int strength)
: base(position, name, health)
{
this.strength = strength;
}
}
}
=Labat FM.book Page 52 Vendredi, 19. juin 2009 4:01 16
