Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Making a ring out of objects?


Betaman

Recommended Posts

Basically what I want to do is make a giant hoop in the air. This giant hoop is composed out of little blobby bits, like in NiGHTS. I want the blobby bits to compose the giant hoop. I use GML, so does anyone know how I could go about doing that? I'd fiddle around, but I don't even know where to start with stuff like that.

Here's an image of what I'm trying to pull off:

0.jpg

Notice how the rings are really composed of those little orange bits.

Link to comment
Share on other sites

I guess what you could do is have an invisible object that's an outline of the ring, something like...

  /---\
 /     \
 \     /
  \___/

...and code it so each of those objects has rings attached to it at specific points like (-10, 0), (-5, 5), etc. That way you could still do the whole "When NiGHTS flies through the center of the invisible ring, he destroys it and gets points) thing.

Link to comment
Share on other sites

In NiGHTS Journey of Dreams, the rings were a single model (made of many identical blobs) with each blob associated to a different bone. I know nothing about GML though, so I don't know if that's the best way to do it.

Link to comment
Share on other sites

I suggest creating the sprite to have an alternate animation where it shrinks. I think that would be a faster solution than to code in something that could be done in a few seconds.

Although you could have an invisible type of object in the ring that several orbs connect to at a certain position, and then shrink it as an animation where its destroyed.

P.S the alternate was a combination of Core and USC's comment.

Link to comment
Share on other sites

Well it's not for a NiGHTS game, it's for a Sonic game. I will, however, try your suggestions and see what happens. Hopefully it doesn't blow up in my face. (Not that the suggestions are bad, it's a joke at my expense.)

Link to comment
Share on other sites

I suggest using analytic geometry itself :I

All you have to do is:

- Divide the stretched length of the circle (2 * pi * circle radius) by the diameter of the "balls" you wish to put around the circle. [Notice that you don't even have to make an actual object for the circle here!]

The result ishow many "balls" you'll need (you may also make your own arbritary number of objects).

- Divide 2*pi by this number, and you'll get an angle in radians. This angle, multiplied by the id of the "ball" object (starting from 0) is the angle each "ball" will assume around the circle.

After calculating that, each ball's coordinates will be:

X = CircleRadius * cosine(angle);

Y = CircleRadius * sine(angle).

I hope that helps... and I also hope someone coud clarify this better than me :S GM has a language next to C++, right? Using maths shouldn't be a problem for you :P

EDIT: Ah you know what?

const float pi = 3.1415;
struct Circle
{
    float X, Y;
    float radius;
};

struct Ball
{
    float X, Y;
    float radius, angle;
};

void makeObjCircle
{
    Circle circle;
    int n_objects

    //This is the actual position of the circle
    circle.X = 0.0f;
    circle.Y = 0.0f;

    circle.radius = 5.0f; //change this to whatever you want.


    n_objects = (int)(2 * pi * circle.radius); //You can either maintain this or make your arbritrary number of balls you want to make.
    Ball balls[n_objects];
    for(int i = 0; i < n_objects; i++)
    {
      balls[i].angle = ((2*pi) / n_objects) * i;
      balls[i].X = circle.radius * cos(balls[i].angle);
      balls[i].Y = circle.radius * sin(balls[i].angle);
    }
}

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...