Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Example / Listing] GM's circles  (Read 4938 times)

0 Members and 1 Guest are viewing this topic.

mit

[Example / Listing] GM's circles
« on: April 03, 2006, 04:28:13 pm »
  • QBASIC programmer since age 4. Take that, world.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 1079
Wondering why this forum is so empty, I thought I'd post something interesting. While I was slightly bored yesterday, I decided to write a script that would draw lines of different thicknesses. Here it is:
Code: [Select]
//draw_line_ext(x1,y1,x2,y2,thickness)
var iiiii;
for (iiiii=-(argument4/2);iiiii<=(argument4/2);iiiii+=0.5)
draw_line(argument0+lengthdir_x(iiiii,point_direction(argument0,argument1,argument2,argument3)+90),argument1+lengthdir_y(iiiii,point_direction(argument0,argument1,argument2,argument3)+90),argument2+lengthdir_x(iiiii,point_direction(argument0,argument1,argument2,argument3)+90),argument3+lengthdir_y(iiiii,point_direction(argument0,argument1,argument2,argument3)+90))
draw_circle(argument0,argument1,argument4/2,0)
draw_circle(argument2,argument3,argument4/2,0)
So that works nice and dandy.
However, while I tested that, I noticed that the circles on each end were... not circles. It appears Game Maker isn't drawing circles, but drawing a polygon of 26 sides. For normal purposes this seems fine, yet, when you want it bigger than the screen, which is not often, it looks quite uncircular.

Therefore, I cam up with a "real circle" script, which was terribly fond of drawing flowers. So I ditched it and asked Atrius to make one, here it is:
Code: [Select]
var dx,dy,w;
for(dy=round(argument1-argument2);dy<=round(argument1+argument2);dy+=1;) {
w=cos(arcsin((dy-argument1)/argument2))*argument2
dx=argument0-w
draw_line(round(dx),dy,round(dx+w*2),dy) }
« Last Edit: February 24, 2012, 10:07:07 am by Niek »
Logged
Programmer / Spriter / Level designer / Game Director / Web Designer / Music Sequencer for
Random Highscore table:

Play the Kousou Arcade today!
  • Kousou Games

some_damn_canadian

Re: GM's circles
« Reply #1 on: April 03, 2006, 09:39:46 pm »
Wow they look pretty good. I tried them but they didn't work. I don't know if there is something I'm supposed to do to make them work but they didn't work for me. The second code is a division by 0. =/
Logged

mit

Re: GM's circles
« Reply #2 on: April 05, 2006, 05:34:59 pm »
  • QBASIC programmer since age 4. Take that, world.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 1079
Well, if you get division by 0, that means you've set the radius to 0. They're scripts, so you add a script and put it in and call it something like draw_realcircle and then somewhere call
Code: [Select]
draw_realcircle(x,y,100)

Erm, there's an example of the line drawing script here.
Logged
Programmer / Spriter / Level designer / Game Director / Web Designer / Music Sequencer for
Random Highscore table:

Play the Kousou Arcade today!
  • Kousou Games

some_damn_canadian

Re: GM's circles
« Reply #3 on: April 05, 2006, 08:27:37 pm »
Well, if you get division by 0, that means you've set the radius to 0. They're scripts, so you add a script and put it in and call it something like draw_realcircle and then somewhere call
Code: [Select]
draw_realcircle(x,y,100)

Erm, there's an example of the line drawing script here.

Ahhhh, no wonder nothing was working for me. I'll edit my post with what I get. n__n

EDIT : The second script worked for me, it's great. n__n But I just couldn't get the first to work. =/
« Last Edit: April 05, 2006, 08:31:12 pm by some_damn_canadian »
Logged

mit

Re: GM's circles
« Reply #4 on: April 05, 2006, 10:15:23 pm »
  • QBASIC programmer since age 4. Take that, world.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 1079
There's an example of the first one, here: http://www.kousougames.co.uk/stuff/draw_line_ext.zip
Logged
Programmer / Spriter / Level designer / Game Director / Web Designer / Music Sequencer for
Random Highscore table:

Play the Kousou Arcade today!
  • Kousou Games

some_damn_canadian

Re: GM's circles
« Reply #5 on: April 05, 2006, 10:51:39 pm »
Awesome, pretty cool! n__n
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.361 seconds with 49 queries.

anything