shoot projectile question
stse888
Member Posts: 3
I've just started using Gamesalad and I would like to know how to fire a projectile into the distance and have the projectile arc downwards as it travels down range. I looked at the Cannon template but I don't know how to apply that example towards my situation.
Comments
Good luck
JCFord
I guess you would change the scale.
So as it is fired it starts off at size 1 halfway grows to size 5 then back to size 1 where it lands/hits.
I guess if you know how far it is going to go, you can control the scale attribute,
or if position is less than 'A' have it increase the scale every 0.1. seconds,
then if its is great than 'A' have it scale down every 0.1 seconds.
And then work out what 'A' is. I guess it would vary depending how strong the power is (if that is varied?). Otherwise it would always be the same number.
Values will no doubt be wrong but something like the following: (if this is a vertical game)
Make a global attribute, shot_power,
Make a global attribute, mid_shot_position
Have a way of assigning a certain number to the shot power, be it a predefined number or one that varies on how long they hold down 'touch'.
Then a rule on an invisible actor (purely in scene for sorting out things like this)
mid_shot_position = shot_power x 100 (or what ever number works for you)
then a rule on the ball,
if position y < mid_shot_position.
change attribute:
(timer every 0.1 seconds)
ball scale x to ball scale x +1
ball scale y to ball scale y +1
if position y > mid_shot_position.
change attribute:
(timer every 0.1 seconds)
ball scale x to ball scale x -1
ball scale y to ball scale y -1
Then to delete ball if failed, (you may or may not want this)
a rule like, if ball scale x = 0
delete actor.
hope it is of some use.
http://gamesalad.com/game/play/80000
not to hijack the post i'm also working on a missile command type game and trying to figure out
how to keep the smoke trail (particle) on the screen till the rocket explodes at it's destination as well as
having the rocket 'image' change it's oreintation based on the path it's traveling.
any thoughts?
Is there really a scale function? I cant seem to find it.