New games every week!
JSE - Stars and Lights Blog
4th August 2021
A couple of basic shapes have been added to the engine.

-=-=-

Stars are stars. You can have up to 32 points on a star, and can set the inner and outer radius.

Star/FillStar/DrawStar x,y,OuterRadius, InnerRadius, Points
Easy!

Next up is Light.
Light is a very cheaply done gradiented circle.
Light x,y,Radius,Strength
Where Strength is from 0 to 1, where 0 has barely any light, and 1 is a full "You might as well draw a circle" circle. Strength defaults to 0.5.
Light (obviously) works best with SetBlend "Light", but you'll likely have issues with slowdown if you use it too much.

Both Star and Light follow Colour/Alpha/Scale/Rotation settings, but not the Skew command because I still can't fathom a nice way to add Skew to shapes without having horrible slowdown when it isn't being used.

Dev Note : On Image/Text commands, I was already setting Scale and Translate for each draw, but now instead I'm using a single Transform command which combines scale, translate and skew, all in one. Shapes don't currently use either Scale or Translate when being drawn, since the Scale+Translate are part of the maths to form the shapes. If I add the Transform in, even just for Skew, it slows everything back down again. Hmmm...

I've also been trying to figure out the best way to add a better lighting system, but I think that requires yet another buffer to get things working properly.
As much as I'm trying to optimise things, every little addition tends to slow it back down again!
Gah!!

// Stars and Lights // by Jayenkai // Created 2021/8/3 Graphics 512,512,1 Repeat CLS ResetDraw SetRot Mills()*0.2 Star 64,64,64,Sin(Mills()*0.1)*20+34,5 FillStar 64,512-64,64,Sin(Mills()*0.1)*20+34,6 DrawStar 512-64,64,64,Sin(Mills()*0.1)*20+34,5 DrawStar 512-64,512-64,64,Sin(Mills()*0.1)*20+34,6 SetRot 0-Mills()*0.1 Star 256,256,100 SetBlend "Light" For m=0 to 2 InkRot m*120,0.95,1 Light MouseX()+Sin(m*120+Mills()*0.1)*64,MouseY()-Cos(m*120+Mills()*0.1)*64,512,0.8 Next Flip Forever

Views 125, Upvotes 21  
Daily Blog , Jse , Commands
New games every week!
Site credits : Jayenkai made this.
(c) Jayenkai 2023 and onwards, RSS feed 78

Blog - JSE - Stars and Lights - AGameAWeek