Skip to content

Instantly share code, notes, and snippets.

@ldunn
Created January 6, 2011 02:51
Show Gist options
  • Save ldunn/767427 to your computer and use it in GitHub Desktop.
Save ldunn/767427 to your computer and use it in GitHub Desktop.
#pragma once
#ifndef BLOCK_H
#define BLOCK_H
class Block
{
public:
Block() {};
virtual Block *newBlock() {};
char faces; // Faces to render (using 6 bits)
char Type;
int DamageTaken;
int DamageThreshold;
};
class AirBlock: public Block
{
public:
AirBlock() : DamageTaken(0), faces(0), Type(0), DamageThreshold(-1) {};
AirBlock *newBlock()
{
return new AirBlock();
}
char faces;
int DamageTaken;
char Type;
int DamageThreshold;
};
class DirtBlock: public Block
{
public:
DirtBlock() : DamageTaken(0), faces(0), Type(0), DamageThreshold(10) {};
DirtBlock *newBlock()
{
return new DirtBlock();
}
char faces;
char Type;
int DamageTaken;
int DamageThreshold;
};
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment