I for the life of me can't figure out how to do a more spread out shot for projectiles im trying to get something like this
http://www.windowscentral.com/sites/wpcentral.com/files/ postimages/4213/Shoot1UPlevel1.jpg
what would be the simplest way to code something like that where the projectiles have that cone like fire?
TRIGONOMETRY!!!!
To keep it simple: cos() and sin() transform an angle into a floating point value that you can use to move projectiles. Even though I just posted a picture of a circle, trigonometry (put simply) is the study of triangles and their relationships: If you want to figure out how big X is, or how big Y is, you need to know Distance and Angle. X = cos(Angle)*Distance Y = sin(Angle)*Distance Need to know how big Distance is and don't know Angle? Pythagorean Theorem: Distance = sqrt(X*X+Y*Y) Need to figure out angle from X&Y? Atan2 proc A cone of projectiles needs to have three basic values: 1) Number of projectiles per wave 2) Angular separation per projectile 3) Starting angle When you've got these three values, you can do: var/cang = start_angle - floor(proj_num/2)*ang_separation |
yeah i got no idea what im doing am i even close?
var/cang = start_angle - floor(proj_num/2)*ang_separation |
Sort of. Instead of Moving src, you want to create a projectile where you are calling Move(). The projectile should move itself.
|
ohh so it should be like this? (ignore the horrid spacing)
obj like that? |
TBH, if you are still turning out invalid syntax that won't even compile, this might not be the system for you to tackle.
My suggestion is to read up on the guide and grasp the syntax of the language a bit better. As I said before. You need to CREATE the projectile and move it into the starting position. The projectile should manage its own movement after creation. But yeah, the first step to making something like this is actually learning how to use the language by understanding the syntax. If you don't understand the syntax, I'm just giving you stuff that you don't understand and you aren't really learning anything. |
First define the vx and vy:
Then using a Move call to move them in angles.
Hope that helps! Remember, though, vx and vy are not predefined, so you'll have to define them yourself.