Ok, so I've solved my last problem thanks to everyone's help above. Remember it's a space invader clone - I chose something simple to get my head around OO code and lists. The invaders are currently all updated each frame.
So now I'm using a Tlink to move through my gameObjectList. It works no problem like this: (part of my main loop)
So now, I want to update one invader per frame, as per the original space invaders game. When I try my solution everything works eg. one invader per frame, but now they don't move in sequence like they used to. Instead a seemingly random invader moves, then another and so on, completely out of sequence. Can someone explain what I'm doing wrong...
So now I'm using a Tlink to move through my gameObjectList. It works no problem like this: (part of my main loop)
Local Link:TLink = AlienObjectList.FirstLink() While Link <> Null Local MyObject:TGameObject = TGameObject(Link.Value()) MyObject.UpdateSelf() Link = Link.NextLink() Wend Flip
So now, I want to update one invader per frame, as per the original space invaders game. When I try my solution everything works eg. one invader per frame, but now they don't move in sequence like they used to. Instead a seemingly random invader moves, then another and so on, completely out of sequence. Can someone explain what I'm doing wrong...
If Link <> Null Local MyObject:TGameObject = TGameObject(Link.Value()) MyObject.UpdateSelf() Link = Link.NextLink() Else Link = AlienObjectList.FirstLink() EndIf Flip