Vector object reference
Vbscript for Howler has a Vector class with the following members and functions"
'If you need more than one vector, there are also instances of the class named Vector1 and Vector2.

x As Single
y As Single
z As Single

Sub
SetVector(x_ As Single, Y_ As Single, z_ As Single)
Sub
SetFromVector(v As VBVector)
Sub
Add(v As VBVector)
Sub
Add_scaler(v As Single)
Sub
Subtract(v As VBVector)
Sub
Sub_scaler(v As Single)
Sub
Mul(v As VBVector)
Sub
Mul_scaler(v As Single)
Sub
div(v As VBVector)
Sub
Div_scaler(v As Single)   
Function
DotProduct(v As VBVector) As Single
Function
VectorLength() As Single
Sub
Normalize
Sub
Limit(min As Single, max As Single) 'limit the magnitude
Function
Mag() As Single
Function
Distance(v As VBVector) As Single
Function
DistanceSquare(v As VBVector) As Single
Sub
SetMag(v As Single)
Sub
Random() 'set to a unit length random normal
Sub
RandomHemisphere() 'set to a unit length random normal
Function
CrossProduct(v As VBVector) As VBVector
Function
CrossProduct2(v1 As VBVector, v2 As VBVector) As VBVector
Sub
Lerp(v As VBVector, mu As Single) 'lerp with this vector
Function
Add2(v1 As VBVector, v2 As VBVector) As VBVector
Function
Sub2(v1 As VBVector, v2 As VBVector) As VBVector
Function
Mul2(v1 As VBVector, v2 As Single) As VBVector
Function
Div2(v1 As VBVector, v2 As Single) As VBVector
Function
Dot2(v1 As VBVector, v2 As VBVector) As Single
Function
Cross2(v1 As VBVector, v2 As VBVector) As VBVector
Function
Lerp2(v1 As VBVector, v2 As VBVector, mu As Single) As VBVector
Function
Reflect(normal As VBVector)
Function
Reflect2(n As VBVector, v As VBVector) As VBVector 'reflect a normal... (n is normal, v is vector)
Function
Refract(normal As VBVector, ByVal eta As Single) As VBVector
Sub
Ceiling()
Function
Compare(v As VBVector) As Boolean
Function
AngleBetween(v As VBVector) As Single
Function
LinerCircleIntersection2d(ByVal cx As Single, ByVal cy As Single, ByVal rad As Single, pos As VBVector) As Long

Code example

public Gravity

function main()

'a version of the particle script using Howler's VBVector class through automation.
'VBScript for Howler has a vector class, called "vector" and there is are also classes named "vector1" and "vector2"
'for when you need more than one vector, for things like cross products, and so on.
'but if you need more than two, like in this case where we have an array of vectors, you will need multiple instances.
'for that, we can create instancs of the vbvector class in Howler through automation.  Let's try.

set Gravity = CreateObject("Dogwaffle.vbvector") 'define a gravity vector and point it downward.
Gravity.y=.25

'there are a lot more types of forces we could use here
'we could use the noise function to create wind
'we could create explosion vectors, or gravity well vectors, etc.
'we could move the emmiter along a path created from keyframes, and the tangent as a vector, etc.


msgbox "Illustrates creating a very basic particle system and using vbvector class in Howler"

dogwaffle.dog_saveundo "Render particles"
w=dogwaffle.dog_bufferwidth
h=dogwaffle.dog_bufferheight

dim count
dim particles()
count=100
redim particles(count-1)


'initialize the particles
for n=0 to count-1
set particles(n)=new particle
particles(n).init w/2,h/2,(rnd-.5)*15, (rnd-.5)*15
next

'this is the main part that initializes the drawing surface, then loops through all particles instances to update and draw them.
drawing.BeginDraw
drawing.setantialiasing true
drawing.Usefill true
drawing.setstrokesize 2
drawing.setstrokecolorRGBA 0,0,0,255
drawing.setfillcolorRGBA 255,0,0,255
for j=1 to 100
'iterate through each particle
for n=0 to count-1
particles(n).update
particles(n).draw
next
next
'this causes everything to be drawn onscreen.
drawing.enddraw
dogwaffle.dog_refresh

end function


'this is the particle class

class Particle
public Position
'these are the vectors for possition and velocity of the particle.
public Velocity
'they are initialized by the init subroutine.  (I don't think VBscript does constructors)

public sub init(x ,y , velocity_x, velocity_y)
set position = CreateObject("Dogwaffle.vbvector") 
' use the VBVector class isntead of the build in Vector class (they are the same thing)
set velocity = CreateObject("Dogwaffle.vbvector")
'but this lets us make a new instance for each particle
position.x=x
position.y=y
velocity.x=velocity_x
velocity.y=velocity_y
end sub

public sub update()
velocity.add (Gravity)
'gravity
position.add (Velocity) 
'had to dereference this with () to get it to work.
end sub

public sub Draw()
drawing.ellipse position.x,position.y,8
end sub
end class