Weird problem with Extended Classes

Monkey Forums/Monkey Programming/Weird problem with Extended Classes

rIKmAN(Posted 2015) [#1]
I've got a bit of a weird problem when using classes Extended from a base class:
Class Child Extends Parent


Basically I have them all in a list, and iterate through them to Update(), Draw() etc.

Now the problem I have is that a few objects in the list don't call the Update() or Draw() methods from the child class, whilst others do.

I have gone so far as copying and pasting a working child class into the file for a non-working child class, and change the class name to match, and it STILL doesn't call the Update() or Render() from the child - even though it does on the object I copied the code from.

Any ideas what could cause this to happen on some objects and not others, when they all created the same way, all Extend the same base class etc

It's not like an error as most of them work, it's just certain ones which is why I can't get my head around it and wondered if anyone has had a similar problem?

I'm baffled and nearly have no hair left to pull out!

Update() and Render() for the child (simplified):

Method Update:Void()
    Super.Update()
End Method

Method Render:Void()
    Super.Render()
    DrawText "Text from child class!",Self.x, Self.y
End Method


So basically some of the objects will draw the text, and others won't, even when that EXACT same code works on another instance.


Dima(Posted 2015) [#2]
Have you tried using Print statement instead of DrawText to test this? One possibility could be that some of the objects change render state like transform and color, and the next Draw command may be affected.