Sunday, 15 May 2011

Graphics

All right, enough of this shit. Let's do some graphics. Let's just get something, ANYTHING, visible in the game.

The tutorial (this one, I think - me, 6 months later) says this will be, and i quote, really easy and straightforward. Hm. We'll see, but I already doubt it.

Ok, so I put in the code the tutorial asked for (which wasn't really easy), but when I try to run the game I get an error message:


I think I've had a similar problem before... hang on, let me check.

Yes, I solved the problem before by setting the graphics to 'Reach' instead of the default (see my earlier post).
Now the game runs, and I have graphics!

Sunday, 1 May 2011

Class clarity

I have my classes working now, since I've figured out the code (see below). I'm still not sure about the meanings of 'public' and 'static'. At first I thought they were mutually exclusive, but I was wrong. You have can have a method which is both public and static, which implies they refer to something different.


Making a new object
ClassName object1 = new ClassName();


Running a method for a particular object
MethodName(object1);
or
ClassName.MethodName(object1);


A method that takes an object for input
static void MethodName(ClassName ClassName)
        {
        }


Refering to an object's variable
object1.variableName

e.g.
Console.WriteLine(object1.variableName);
or
object1.variableName = 6


A new class
class Monster
    {
        public int variableName;
    }


A new method within that class
public static void MethodName(ClassName ClassName)
    {
    }