draw circle at collision point?

BlitzMax Forums/BlitzMax Beginners Area/draw circle at collision point?

slenkar(Posted 2008) [#1]
How would you draw a black circle on an image, where it collided with a bullet?

I know the screen co-ords of the collision but how do I get the local co-ords to write on the pixmap.

and how do I draw a filled circle on a pixmap


xlsior(Posted 2008) [#2]
subtract the x and y coordinates of the upper-left corner of your pixmap from the x and y coordinates on the screen.

e.g. your bullet impact happens on screen location 400,350 and your uper left corner of the pixmap is at 300,300, then the location inside the pixmap is (400 -300) = 100 and (350 - 300) = 50, so 100,50 inside the pixmap.


slenkar(Posted 2008) [#3]
oh yeah, i wasnt thinking,

how would I put a black circle on the image/pixmap


xlsior(Posted 2008) [#4]
If you have no alpha transparancy, you can draw the pixmap, draw the bullet hole, and grab another copy of the pixmap.

However, since it's not very fast to draw pixmaps or to convert between pixmaps and images, you may find it faster to to simply keep track of the locations of the bullet holes, draw the image, and then draw the bullet holes on top of them each frame.

that way you won't have any hiccups in the game while you're creating new images on the fly.


slenkar(Posted 2008) [#5]
yeah true,it would be faster, dont think that would update the collisions if I just drew the holes,

so the plan is to draw the rock,take out the bullet holes and then grab the pixmap every time it is shot,

thanks for the help