How do I make a Sphere (Globe)?

  • Hi everyone,

    I want to make a pseudo Sphere (Globe) that i can rotate and select a country on it. How can i accomplish this with C3?

  • Bump!

  • Construct is a 2D engine, I don't know if there is a way to rotate 3D object.

    The only solution is to add lots of frames like this:

    dropbox.com/s/7rrjq240qvwsykq/slider-pulsar2.capx

  • C3 has a z, so technically you could project tiles in 3d with a little trig.

    Not as a sphere, but something that would work nicely for selections.

  • newt

    Thanks for replying, Thats a good idea for 3d type menu but the game needs it to be a globe (Sphere).

    dop2000

    Thanks for the idea and example file, this might work just fine, i will add different frames for globe... any idea for detecting which country player selected though?

  • If you don't have too many countries you can paint them in different colors and read pixel color under mouse cursor (using Drawing Canvas). Or maybe define lots of image points and find the nearest image point to mouse click, but this is a huge job as you'll need to do this for every animation frame..

  • Thats a really great idea, I am planning to use all 198 countries,

    Detecting color seems easy as for image points i have to set them for all countries and for each frame too.

    But can you please explain how do you detect the color underneath cursor with drawing canvas...

  • Derp, I forgot about Tiled Backgrounds image offset.

    You can easily replicate a globe using a mask.

  • newt

    I tried what you said.... with "crystal ball" effect...

    I am figuring out values to set for tiled offset along with touch X.

    Thanks a lot for the idea.

  • If you apply a distortion effect like Crystal ball, you will need to account for it when determining which tile was clicked. There's probably a formula, but I don't know it.

    Also, I don't think it's possible to change image offset in runtime, this property is only available in editor. I guess it's not really needed, you can use two copies of the tilemap, or put two maps on one tilemap, and move the entire tilemap. But, you'll still need to prepare the array of all tiles and their corresponding countries. With 198 countries I imagine the tiles need to be quite small and this array will be really big...

    .

    As for my first suggestion - distinguishing 198 countries by color may not be very accurate. You need to put a small Drawing Canvas object in the position where the map was clicked, paste the map onto it, then do "Drawing canvas save snapshot", and after that you'll be able to read RGB values of the pixel.

  • newt

    dop2000 I think you misinterpreted "TiledBackground" with "Tiled Maps" there...

    also Fortunately there are actions to set image offset at runtime,

    so i made this so far, but it doesn't look right for some reason,

    like it flips image when i add crystal ball effect to tiled background (might be a bug)

    and there is too much shine on image making it invisible at some places

    am i missing something?

    https://drive.google.com/file/d/1CVzmS7CSwy5ZteepDD-QmansOG9-xaZ4/view?usp=sharing

  • Yes, I though about TileMap.. Forget about the crystal ball, I found an effect that creates a perfect sphere, with rotation!

    construct.net/en/make-games/addons/242/glsl-sphere

    I still don't know how to detect which country is clicked, but I'm sure you'll figure it out :)

  • Offset is new in C3 dop2000

    There is a C2 third party equivalent.

    construct.net/en/forum/extending-construct-2/addons-29/plugin-sprite-sheet-68007

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • newt Yeah, I got TiledBackground and TileMap mixed up, sorry. TileMap also has image offset, but you can't change it with events.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)