Bezier Curves
The Bezier alteration will move your sprite along a curve you specify with a path.
Curves are implemented via cubic bezier curves(View on Wikipedia), that is, a start point, an end point, and 2 guide points between them.
- Curve coordinates are mapped relative to the sprite's location when the alteration is applied
- start is a point separate from the main coordinate list (path.) start acts are a guidepost. It has nothing to do
with where your sprite is or will be. Let me explain: If you use a drawing program to design a path, you'll draw the curve on the canvas of the drawing program. But you don't know how your sprite will map to that canvas. So the start point lets you tell SCL™ that when designing the curve you started at that point so SCL™ can map all the later coordinates relative to that point, then apply those points to where the sprite actually is.
- Each coordinate is mapped by subtracting the start point position from its value. This gives a relative position to the current position of the sprite (trust me, its magical)
- A simple way to design your curves is in GIMP (gimp.org). Use the curve drawing tool then export the curve as a text file and edit the curve description.
- Since coordinates are relatively mapped, when designing your curve you don't need to guess where your sprite might be.
- You can specify orientation as being none, normal or tangent. This describes the angle that the sprite will hold as it follows the curve
- If you need the sprite to loop the curve infinitely, then set a high value for laps such as 9999999.
create routine as Start launch curver end
create sprite from attacker1.png as curver
where x=640 and y=80
having alt=bez1
end
create bezier as bez1
where start=775,81
orientation=tangent
time=3000
laps=2
path="775,152 670,191 611,157 534,112 538,65 478,93 291,244 287,68 223,85 -31,297 24,50 39,48 104,8 120,213 403,54 537,-2 537,149 718,37 748,28 776,18 775,81"
end
- completion={name}
- the name of a routine to run with the sprite is finished following all the laps of the curve.
- laps={number}
- how many times sprite should follow the path. For unlimited, use a high number like 99999999
- orientation={none|normal|tangent}
- indicates how to angle the sprite on the path
- path={"x,y "...}
- a series of points separated by spaces. The first two points are guides leading from start. Do not put a linefeed inside the path value.
- start={number,number}
- x,y position from which to compare path coordinates. See the notes above
- time={number}
- a rough guide to how long it should take the sprite to traverse the path