Stencyl 3.4.0 is now out. Get it now!

Drawing Utils Extension [1.3.2]

Donni11

  • *
  • Posts: 2175
@CanadianHobo, I just tried it now ,seems fine, I didn't encounter any errors . Try using chrome. Maybe it your virus protector or something.
The Stencyl Discord Channel , Where the real Stencyl work happens ;).

Donni11

  • *
  • Posts: 2175
@ETHproductions, by " angle ' for this block :



What do I type in by angle ?
The Stencyl Discord Channel , Where the real Stencyl work happens ;).

ETHproductions

  • *
  • Posts: 405
@CanadianHobo: Sorry for the late reply. It's hosted on Dropbox.com, and the links are shortened with bit.ly, so I don't know why there would be a problem there. It works for me; does it work for you now?

@Donni11: It's the rotation of the rectangle or ellipse, in degrees. If you gradually change the angle from 0 to 360, the shape will spin in a full circle.

@yoplalala: Glad you find the code useful for your extension. And yes, I did put the peanut code there. It was a failed attempt to draw an ellipse, but the result looked kinda cool, so I thought I'd leave it. I'll make it into a block, if you want :)
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Donni11

  • *
  • Posts: 2175

@Donni11: It's the rotation of the rectangle or ellipse, in degrees. If you gradually change the angle from 0 to 360, the shape will spin in a full circle.


So I want it to stay Straight I should type in 180 ?
The Stencyl Discord Channel , Where the real Stencyl work happens ;).

yoplalala

  • *
  • Posts: 1386
no 0 :)

in STencyl


180------------------------0
                            |
                            |
                            |
                         90
     

Donni11

  • *
  • Posts: 2175
Oh, I get it. Thanks !
The Stencyl Discord Channel , Where the real Stencyl work happens ;).

Donni11

  • *
  • Posts: 2175
Also, once I draw a rectangle how am I able to fill it up with a color ?
The Stencyl Discord Channel , Where the real Stencyl work happens ;).

yoplalala

  • *
  • Posts: 1386
you cannot draw and fill a rectangle directly with this extension. But you can just do another filled rectangle ( click on "draw" , you will have the fill option)

designpeg

  • *
  • Posts: 493
hi, where do you download v1.3 from?

UnusualCadence

  • *
  • Posts: 133
Quick bump question! It seems that the "Draw Arc At Center" block tanks the framerate on mobile - I'm drawing loads of circles, squares, stars and other things to the screen, but the 'arc' one drops the framerate down to 40 and lower on an iPhone 5c depending on how great the angle range is.
 
Is there any reason this might be happening - is it a bug or just a limitation of the drawing features in OpenFL? :)

yoplalala

  • *
  • Posts: 1386
Things like Arcs cost power  ( but maybe there is a way to change the algorithm), it has to use plenty of cos and sin in a single frame.
If you want to have better frame rate , you can draw the arc on a image ( there's one extension to draw on a image). Like this you make only the complex calculation once.

As you can see the arc is plenty of little lines.

public static function drawArc(g:G, x:Float, y:Float, s:Float, e:Float, r:Float) {
      var tempx1:Float;
      var tempy1:Float;
      var tempx2:Float;
      var tempy2:Float;
      while (s < -180) { s += 360; e += 360; }
      while (s > 540) { s -= 360; e -= 360; }
      while (e < -180) { e += 360; }
      while (e > 540) { e -= 360; }
      if (s % 1 != 0) {
         tempx1 = x + (r * Math.cos(s * Utils.RAD));
         tempy1 = y + (r * Math.sin(s * Utils.RAD));
         tempx2 = x + (r * Math.cos(Math.ceil(s) * Utils.RAD));
         tempy2 = y + (r * Math.sin(Math.ceil(s) * Utils.RAD));
         g.drawLine(tempx1, tempy1, tempx2, tempy2);
      }
      for (i in -180...540) {
         if ((s <= i) && (i + 1 <= e)) {
            tempx1 = x + (r * Math.cos(i * Utils.RAD));
            tempy1 = y + (r * Math.sin(i * Utils.RAD));
            tempx2 = x + (r * Math.cos((i + 1) * Utils.RAD));
            tempy2 = y + (r * Math.sin((i + 1) * Utils.RAD));
            g.drawLine(tempx1, tempy1, tempx2, tempy2);
         }
      }
      if (e % 1 != 0) {
         tempx1 = x + (r * Math.cos(Math.floor(e) * Utils.RAD));
         tempy1 = y + (r * Math.sin(Math.floor(e) * Utils.RAD));
         tempx2 = x + (r * Math.cos(e * Utils.RAD));
         tempy2 = y + (r * Math.sin(e * Utils.RAD));
         g.drawLine(tempx1, tempy1, tempx2, tempy2);
      }
   }

colburt187

  • *
  • Posts: 2051
Does this extension work on the latest version of stencyl? I couldn't seem to install the extension.

LIBERADO

  • *
  • Posts: 2379
Does this extension work on the latest version of stencyl? I couldn't seem to install the extension.
Yes, it works. Try to uncompress the zip file, delete the file called "Archive created by free jZip", and compress the folder again to zip format. Then, you will be able to install it.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

colburt187

  • *
  • Posts: 2051
Im on mac, normally I drop the downloaded folder into the engine-extension folder and it shows up in the extension tab, but Ive tried a few times no and I can't get this to show up.

Im on build 9180.

LIBERADO

  • *
  • Posts: 2379
Delete the file called "Archive created by free jZip" which is inside the folder.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.