DrawLine DrawCircle Problem

Monkey Forums/Monkey Programming/DrawLine DrawCircle Problem

monkeyben(Posted 2013) [#1]
I am going through the second tutorial of the Monkey Game Development book and I am experiencing some weird behaviour. I've tried it in the demo build and I've just brought and installed Pro build 69.

This is the problem: If I have the code below in the game DrawCircle works but the rocket/bomb trails don't render using DrawLine. If I uncomment the DrawLine line (that just renders a test line) DrawLine renders the trails but DrawCircle doesn't draw anything!? :-S

Anyone have any ideas how I can find where the problem lies? Thanks :)

Method RenderGame:Int()
	SetColor(0, 0, 150)
	' DrawLine(0,0,100,100)
	DrawRect(0, cHeight-40, cWidth, 40)
	RenderCities()
	RenderLaunchers()
	RenderRockets()
	RenderExplosions()
	RenderBombs()

	Return True
End



Redbeer(Posted 2013) [#2]
It's difficult to help with the code you posted here...

The details of what you've put in the other Render method calls matters.

If I had to guess, I'd check if you are clearing screen between calls, something is rendering over top of something else, or you are setting the Alpha to 0 in some place that doesn't get reset to 1 in the next draw.


MikeHart(Posted 2013) [#3]
Hi monkeyben,

thanks for getting the book. I just checked the code files that you can download with the book and they run fine in v69.

So either you have typed something wrong or it is written wrongly in the book. In about 2-3 weeks I have time to go over the written stuff in the book.

Cheers
Michael


MikeHart(Posted 2013) [#4]
The RenderGame method you have posted looks fine to me.


monkeyben(Posted 2013) [#5]
Hi Guys, thanks for your help :)

I finally tracked it down in the OnRender function: -

Method OnRender:Int()
	Cls(0, 0, 50)
	Select gameMode
		Case gmMenu, gmGameOver
			RenderGame() ' <-- this line
			RenderMenu()
		Case gmPlay
			RenderGame()
	End		
	Return True
End


I'd left out the RenderGame() call in the menu's case because I thought it was a typo in the book!

Thanks for writing the book Michael :)


MikeHart(Posted 2013) [#6]
I am glad you got it working.


monkeyben(Posted 2013) [#7]
Thanks Mike :)