Interesting polymorphic problem.

BlitzMax Forums/BlitzMax Programming/Interesting polymorphic problem.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I can see why its getting stuck. But not exactly sure why you would do that. All you are changing is your blend mode and calling the same draw function, which with dynamic binding will just recursively call the closest (in this case TPlayer's) method in the heiarchy to the runtime type of that object. Hope that makes sense.

But if you're trying to alter draw SETTINGS i'd recommend abstracting it out a little more. I've used drawStates or renderstates to help with drawing special types.

so for instance

Type TSprite
   Field rState:RenderState

   Method Draw()
   End MEthod

End Type

Type TPlayer extends TSprite
   
   Method Draw() 'overridden
      Super.Draw()
      rstate.set()
      Super.Draw()

   End Method

End Type

Type RenderState
	field alpha
	field scalex
	field scaley
	field rotation
	field blend
	field r,g,b
	
	method new()
		r= 255
		g = 255
		b = 255
		alpha = 1
		rotation = 0
		scalex = 1
		scaley = 1
		blend = SOLIDBLEND
	end method

	method set()
		setcolor r,g,b
		setrotation rotation
		setalpha alpha
		setscale scalex,scaley
		setblend blend
	end method

End Type


and for player sprites you simply alter the renderState on creation and you'd be set.