Posts

Showing posts from August, 2017

GMStruct Inheritance and Types

In a previous post, I went through the basic usage of GMStruct, but I deliberately left out some details about inheritance and types. This is what I will be covering in this post.

Basic Types First of all, let's go over types in GMS. The first thing to note is that GMS comes with a set of basic types you can use: The String, Real, Pointer, Array and Boolean types.
You can use them to set the type of your struct attributes, in order to restrict the types of values you can pass to them at runtime. So far, nothing new.

Struct Types However, there are more types available in GMS; every struct you define will have its own type. This allows you to define an attribute to have a struct type.
For instance, you could have a Cat and an Owner struct. The Cat struct may have an owner attribute. That owner struct would be defined to be of type Owner.
This would look like this:



Inheritance So now we have basic struct types out of the way, let's have a look at inheritance.
Let's look at t…