ID:2025500
 
(See the best response by Ter13.)
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?

You'll need to use angles.
First define the vx and vy:
vx = speed * cos(angle)
vy = speed * -sin(angle)

Then using a Move call to move them in angles.
Move(loc, dir, step_x + vx, step_y + vy)

Hope that helps! Remember, though, vx and vy are not predefined, so you'll have to define them yourself.
Best response
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
atan2(x,y) //don't worry about this. It works.
. = (x||y)&&(y>=0 ? arccos(x/sqrt(x*x+y*y)) : 360-arccos(x/sqrt(x*x+y*y)))


Angle = atan2(X,Y)




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
var/count = 0
while(count++<proj_num)
//create and fire the projectile:
//projectile's angle will be cang. set it up to move using cos(cang)*speed and sin(cang)*speed for x/y movement offsets
cang += ang_separation
yeah i got no idea what im doing am i even close?

var/cang = start_angle - floor(proj_num/2)*ang_separation
var/count = 0
while(count++<proj_num)
//create and fire the projectile:
var/obj/A=new/obj/projectile(src.loc)
Move(loc, dir, cos(cang*speed), sin(cang)*speed)
//projectile's angle will be cang. set it up to move using cos(cang)*speed and sin(cang)*speed for x/y movement offsets
cang += 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
projectile
icon='pro.dmi'
Move(loc, dir, cos(cang*speed), sin(cang)*speed)


like that?
...That's completely invalid syntax.
so what should it be then?
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.