User Tools

Site Tools


notes:fall2024:projects:msi1

This is an old revision of the document!


msi1

The primary difference between the last and current project is that instead of using arrays, linked lists are to be employed instead. Essentially, all instances of arrays in msi0 must now be retired in favor of the singly linked list. This game will utilize new struct attributes and functions to achieve this goal. The end product should feature ZERO arrays, and, if done correctly, one or more linked lists (pending designer preference).

malloc

pointer arithmetic

node struct

To make your node struct, you need to take whatever you are making into a list, in this case your Sprite/Enemy/GameObject struct, and add a next pointer to it ie

struct Sprite {
   int X;
   int Y;
   bool Active;
};

will become

struct Sprite {
   int X;
   int Y;
   bool Active;
   Sprite *next;
};

list struct

Currently a list needs two things: A start and an End

struct List
{
   Sprite *start;
   Sprite *end;
}

singly-linked list

A singly linked list is a group of nodes that each have some way of finding the next node in the list.

space invaders

notes/fall2024/projects/msi1.1726263077.txt.gz · Last modified: 2024/09/13 21:31 by cmazzara