Lazer beams

BlitzMax Forums/BlitzMax Beginners Area/Lazer beams

Schwang(Posted 2007) [#1]
Hi guys. Did a forum search but didn't quite find what I needed.

I need a lazer beam at any angle between two points, preferrably using an unstrected image because I'd like it to animate. Let's assume the image is an animation in dimensions 13 x 5.
This means the ideal would be if it could tile.

I also need help with the maths to center the image correctly along the line, and to ensure the image is cut at either point, i.e. stops tiling when the desired length is reached.

Assumedly collision can be checked via the normal imagescollide functionality?

Any sample code would be greatly appreciated.
---

Additionally, what would be the best way to implement a similar lazer using a stretched image, also centered?


Schwang(Posted 2007) [#2]
Does BlitzMax have a function that allows you to define 4 points, and then draw an image to fill the space in those 4 points, taking in account its rotation with optional stretch or tile properties?


jkrankie(Posted 2007) [#3]
look at setImageHandle and AutoMidHandle in the docs for centering images, it works with rotation too.

There is a function in the code archives that calculates the angle between two points, just set the image rotation to the angle the function returns.

Cheers
Charlie


tonyg(Posted 2007) [#4]
There are a few user-written texturedpoly functions but can't you use drawimagerect?