Skip to content

Instantly share code, notes, and snippets.

@ScottLilly
Created April 18, 2014 18:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ScottLilly/8cc706357c4b33e13a54 to your computer and use it in GitHub Desktop.
Save ScottLilly/8cc706357c4b33e13a54 to your computer and use it in GitHub Desktop.
Lesson 05.1 - Creating objects from classes
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Engine;
namespace SuperAdventure
{
public partial class SuperAdventure : Form
{
private Player _player;
public SuperAdventure()
{
InitializeComponent();
_player = new Player();
_player.CurrentHitPoints = 10;
_player.MaximumHitPoints = 10;
_player.Gold = 20;
_player.ExperiencePoints = 0;
_player.Level = 1;
lblHitPoints.Text = _player.CurrentHitPoints.ToString();
lblGold.Text = _player.Gold.ToString();
lblExperience.Text = _player.ExperiencePoints.ToString();
lblLevel.Text = _player.Level.ToString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment