This is an old revision of the document!
One way to make randomly moving enemies is to have them spawn at random positions and going different directions at different speeds and bouncing around like PC screen saver!
One way to use trigonometric functions is to model how your enemies will move. Maybe you want them to move in a circle? Or in a cosine wave? The Vircon “math.h” library has functions to help you achieve this.
To Append is to Add After, not Before. With doubly linked lists we can now go backwards. When adding stuff to the end of a list we need to check where we are adding the node to as that decides the rest of what we do. You need to check for if the Old_Node that New_Node is going after is:
1. At the Start/Doesn't Exist 2. At the End 3. or in the Middle
One way to tell for the First option is to see if your list == NULL. If so then the lists two ends need to point to the New_Node and it's next and previous need to be NULL as there are no other nodes in the list.
One way to tell for the Second option is to see if your Old_Node == end of the list. If so then Old_Node now point to the New_Node which point's right back at it, but the New_Node also needs to point somewhere else else.
The Third option is like the Second in terms of pointing but that New_Node needs to point at what Old_Node was pointing at next before it was pointing at New_Node.
Don't forget that since this is a function it needs a return value!