shield graphics code and help

BlitzMax Forums/BlitzMax Programming/shield graphics code and help

Cruis.In(Posted 2006) [#1]
hey everyone, I have been experimenting with different ways to create the shield, and shield effect for a game.

Instead of making an image which I can fit to the ship, which would take alot of work to resize it for each ship... I want to generate some sort of graphic using code. Ive searched and haven't seen any code trying this yet, so I was wondering if I could get some pointers in the right direction.

just so you can see what I have in mind, ill post the ignorance I was doing.

First I tried storing a DrawOval command in a variable, with variables for the current ship size.

local shieldimage = drawoval (ship.x , ship.y, imagewidth(shipimage), imageheight(shipimage))

of course i get an error, saying can't convert timage to int. So that was out.

then i tried just drawing the oval,

DrawOval(ship.x -ImageWidth(ship.shipimage)/2 , ship.y-ImageHeight(ship.shipimage)/2, ImageWidth(ship.shipimage),ImageHeight(ship.shipimage))

that was to get the oval directly over the ship. I had transparency and stuff set on it, so you can see through it.

but the oval rotates funny, and it cannt get it to rotate by its centre, so it goes around in a circle, when i turn the ship. circling the ship. auto mid handle and sethandle was no help either.

Basically i want that when the user raises the shield with the keyboard command, that the shield is now true, that part is easy, but i want the shield even though it is now "ON". to be invisible around the ship, until it is hit by projectile fire. I want to create and effect so that when it the shield glows bluish, witish sort of haze briefly then fades back to invisible....

what are some commands i can investigate to achieve this?

thanks in advance


AlexO(Posted 2006) [#2]

DrawOval(ship.x -ImageWidth(ship.shipimage)/2 , ship.y-ImageHeight(ship.shipimage)/2, ImageWidth(ship.shipimage),ImageHeight(ship.shipimage))



sounds right. And if you want to rotate the oval around the ship (I may be wrong), you *should* be able to do:
SetHandle(imageWidth(ship.shipimage)/2,imageHeight(ship.shipImage)/2)



I want to create and effect so that when it the shield glows bluish, witish sort of haze briefly then fades back to invisible....


when thinking of this I would start out messing around with these:
SetBlend(lightblend)
setAlpha()
and some sort of clever animated image. And just reduce the alpha as time goes on.


Cruis.In(Posted 2006) [#3]
when thinking of this I would start out messing around with these:
SetBlend(lightblend)
setAlpha()
and some sort of clever animated image. And just reduce the alpha as time goes on.



oh geez, ive done that before for cloaking, why the hell didn't i think of that? does this sort of thing happen to others? then again its been one year since ive looked at blitzmax code, and did all those "genious" things.

i need to go back to writing pseudo code, then putting the appropriate commands next to them. such as, cloak which is fade, (setalpha) till i get back into things.
thanks


klepto2(Posted 2006) [#4]
hi, Cruis.In. As said, here is a small sample about scaling and already a small shield effect:

use arrows to move and a and y to zoom in and out:



If you have questions, then simply ask here or email me ;)


Cruis.In(Posted 2006) [#5]
hi klepto thanks.

theres a command to check for collision between an image and a drawn oval or rect?


Dreamora(Posted 2006) [#6]
CollideRect


Cruis.In(Posted 2006) [#7]


this is what id like.


SillyPutty(Posted 2006) [#8]
why not place an image over the ship that you could scale ?


Cruis.In(Posted 2006) [#9]
ahh.. man sometimes i just don't think of these things.

I could set the width and height of said image to be a variable equal to the width and height of the current chosen ship, using imagewidth() and imageheight().
that solves the problem of the varying size right? just set the scale of the shield image to the size of the current ship graphic....

am I on the right track?