Skip to content

Instantly share code, notes, and snippets.

@ericoporto
Last active July 5, 2017 03:23
Show Gist options
  • Save ericoporto/bd0c1dd27ff7438c006b8cdbcc7befd6 to your computer and use it in GitHub Desktop.
Save ericoporto/bd0c1dd27ff7438c006b8cdbcc7befd6 to your computer and use it in GitHub Desktop.
My notes while learning to use Adventure Game Studio

Simple struct declaration

struct Pos {
 int x;
 int y;
}

Pos initialPosition;
Pos importantPosition[3];

This kind of struct though can't be passed as argument of a function.

Managed Struct

managed struct Pos {
 int x;
 int y;
}

Pos * initialPosition;
Pos * importantPosition;

//we can't use 'initialPosition = new Pos;' in the body, it needs to be in a function

function initialisePositions(){
    initialPosition = new Pos;
    importantPosition = new Pos[3];
    importantPosition[0] = new Pos;
    importantPosition[1] = new Pos;
    importantPosition[2] = new Pos;
    
}

function moveDancingTo(Pos * destination){

    // do something with destination

}

Managed strucs allow passing structs as parameters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment