Game Maker Community: 2d Super Mario Galaxy Gravity - Game Maker Community

Jump to content

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

2d Super Mario Galaxy Gravity

#1 User is offline   $pecter 

  • GMC Member
  • Group: GMC Member
  • Posts: 1569
  • Joined: 11-May 05

Post icon  Posted 09 January 2008 - 10:32 PM

Local Moderators said:

Replies to topics in this forum are held to a high standard. Reviews must have a critique or suggestion for use to be approved. Read the rules here.


2D Super Mario Galaxy Gravity
  • Title: 2D Super Mario Galaxy Gravity
  • Description: 360° platformer gravity. Including support for non-circular planets.
  • GM Version: GM6
  • Registered: Yes.
  • File Type: .gm6 (mirror: .zip)
  • File Size: 36 kB (mirror: 15kB)
  • File Link: Super_Mario_Galaxy_Gravity (mirror)

Additional Info

Credit appreciated.

In-Depth Description:
This example revolves around getting the character to move 360° around any shaped 'planet'. The method it uses to accomplish this goes like this:

Finding the nearest ground is probably the trickiest part to grasp but basically, the character just checks for collision in a circle constantly increasing in radius (using the collision_circle function). If a collision is found it then checks each point on the circle (360 default) to find the exact location of collision (using the lengthdir_? functions in combination with the position_meeting function). The gravity_direction is then adjusted to the direction of the point

Another tricky part is to find what angle the terrain slope is at. This example accomplishes this by sending two "rays" downwards (one on either side of the character) in the direction of gravity (found by the previous step) until both hit the ground. A right-angled triangle is then formed between the two co-ordinates where the rays hit and the angle is worked out from that by using simple trigonometry.

The movement is relatively simple in comparison to the rest of the code. The character simply moves in a direction perpendicular (90°) to the gravity direction. Jumping is accomplished in much the same way by sending the character in a direction 180° from the gravity_direction.

The rest of the example is relatively simple code that does not need to be explained in detail.


And just to clear things up, this is not the engine the Frozzd uses. I made it myself. 2DCube made his own engine.

Enjoy,
$pecter

This post has been edited by $pecter: 16 November 2008 - 11:16 PM

0

#2 User is offline   makerofthegames 

  • Makin' Games
  • Group: GMC Member
  • Posts: 4195
  • Joined: 03-December 06

Posted 10 January 2008 - 02:22 PM

Awesome! 10/10 for what its sopose to do.

EDIT: Whoaa...Over two years ago.

My spelling now isn't what it was then I'll tell you that.

This post has been edited by makerofthegames: 12 January 2010 - 08:19 PM

0

#3 User is offline   Kopaka13 

  • Creator of Froggy
  • Group: GMC Member
  • Posts: 173
  • Joined: 18-November 07

Posted 10 January 2008 - 05:26 PM

Hey, that's a great example! You might want to add some more features (eg square planets, comets, monsters, black holes, a view, screen wrapping, etc.) but otherwise it's an excellent example. I might actually use this for one of my recent games, "Froggy Gravity".
0

#4 User is offline   Clarkyboy 

  • GMC Member
  • Group: GMC Member
  • Posts: 897
  • Joined: 04-May 07

Posted 10 January 2008 - 08:01 PM

Wow thats really cool, good work! ;)
0

#5 User is offline   Rybo5000 

  • GMC Member
  • Group: GMC Member
  • Posts: 423
  • Joined: 01-November 06

Posted 10 January 2008 - 08:59 PM

This seems to be working really well. Nice one!
0

#6 User is offline   Joerdgs 

  • Clavus Studios
  • Group: GMC Member
  • Posts: 393
  • Joined: 08-March 05

Posted 10 January 2008 - 10:00 PM

This is TOO awesome ;)

11 out of 10 for sure! The YoYo Games Winter Competition winner used this code right?
0

#7 User is offline   JishHD 

  • GMC Member
  • Group: GMC Member
  • Posts: 1424
  • Joined: 26-February 07

Posted 11 January 2008 - 12:04 AM

this tutorial is absolutly amazing! great job with all the coding and the work! just to test how good it is, i made a planet sprite that was just a mess of circles and blobs, and it still works perfectly! 11/10!
0

#8 User is offline   I*Monkey 

  • World Class Acrobat
  • Group: GMC Member
  • Posts: 161
  • Joined: 24-December 07

Posted 11 January 2008 - 12:32 AM

Nice tut man, you really have put alot of work into this ;)
Now, when you are not near any other planets (say, at the centre of the centre planet) and you jump, there is always a gravity pulling you either left or right.
Nothing wrong with this, just it would look more CLEAN if he just jumped with no horizontal pull added, only the vertical jump.
0

#9 User is offline   $pecter 

  • GMC Member
  • Group: GMC Member
  • Posts: 1569
  • Joined: 11-May 05

Posted 11 January 2008 - 04:35 AM

Thankyou everyone for your kind comments.
I'll take them into account and try to improve this.
0

#10 User is offline   2Dcube 

  • Programming sucks
  • Group: GMC Member
  • Posts: 530
  • Joined: 01-November 03

Posted 11 January 2008 - 11:43 AM

joerdgs said:

The YoYo Games Winter Competition winner used this code right?


No, I made it myself. Well, I started from a very basic slopes tutorial.

This tutorial is pretty good, but the jumping is not correct. Sometimes you jump very far (from one side to the other side of the planet), and sometimes only 1 centimeter (on the screen). I had the same problem with Frozzd but was able to fix it. Maybe I should release the source code <_<.
0

#11 User is offline   mugensur 

  • GMC Member
  • Group: GMC Member
  • Posts: 348
  • Joined: 25-August 06

Posted 11 January 2008 - 03:47 PM

Well, it's nice except for the jump problem that some mentioned already.
0

#12 User is offline   Hach-Que 

  • RoketGames Admin
  • Group: GMC Member
  • Posts: 1448
  • Joined: 08-December 04

Posted 12 January 2008 - 07:55 AM

If you have an object rotating, and you just stand there, it doesn't recalculate when the object starts to pass over you, and thus, you go straight through the object.
0

#13 User is offline   nickolasr 

  • GMC Member
  • Group: GMC Member
  • Posts: 1149
  • Joined: 03-June 07

Posted 12 January 2008 - 07:32 PM

This is possibly one of the greatest examples on the gmc.flawless.

a perfect 10/10! :)
0

#14 User is offline   $pecter 

  • GMC Member
  • Group: GMC Member
  • Posts: 1569
  • Joined: 11-May 05

Posted 13 January 2008 - 12:47 AM

I've updated a bit, rotating planets now work and the jumping is a little better (but still not perfect).
0

#15 User is offline   JishHD 

  • GMC Member
  • Group: GMC Member
  • Posts: 1424
  • Joined: 26-February 07

Posted 13 January 2008 - 09:50 PM

i love the new update! the tutorial is much improved from the first version, and the jumping and rotating planets are a plus! there's still a small glitch when going around the sharp corners of the box. the image shifts a little and gets sorta glitchy. it might be something to look in to (i noticed that 2Dcube's game Frozzd had that same glitch when running around corners. it would be a very good thing to solve, but it's just a suggestion :rolleyes:

great tutorial so far! i cant wait for the next version!
0

#16 User is offline   Dancing Firefox 

  • GMC Member
  • Group: GMC Member
  • Posts: 9
  • Joined: 13-January 08

Posted 14 January 2008 - 10:11 AM

An excellent gravity example there $pecter, well done!

Just a slight problem: The camera jumps from side to side whenever Mario touches the peanut planet or a certain side of other circular planets - it may be a problem with the view or the collision check, but from other people's posts I may be the only one experiencing this. Otherwise, fantastic!
0

#17 User is offline   I*Monkey 

  • World Class Acrobat
  • Group: GMC Member
  • Posts: 161
  • Joined: 24-December 07

Posted 15 January 2008 - 05:27 AM

$pecter, you have improved this game out of sight! And i just reflects on the skill level in some of G.M's developers around today. You are gifted man, i'll put it that way :(

This post has been edited by I*Monkey: 15 January 2008 - 09:36 PM

0

#18 User is offline   ZeppelinK 

  • GMC Member
  • Group: GMC Member
  • Posts: 4
  • Joined: 20-June 07

Posted 16 January 2008 - 12:19 PM

Can I use this? I will modify it a little, and I will do everything else but the gravity.
I would say your name in the credits with font 72... ..Nah, just a little bigger? ;P
0

#19 User is offline   $pecter 

  • GMC Member
  • Group: GMC Member
  • Posts: 1569
  • Joined: 11-May 05

Posted 16 January 2008 - 10:37 PM

Quote

Can I use this? I will modify it a little, and I will do everything else but the gravity.
I would say your name in the credits with font 72... ..Nah, just a little bigger? ;P

Of course you can use it. All things in this sub-forum should be generally free to use, otherwise what would the point be?
But yes, if you use it credit would be nice.
0

#20 User is offline   Seemliss 

  • GMC Member
  • Group: GMC Member
  • Posts: 100
  • Joined: 16-January 08

Posted 17 January 2008 - 12:48 AM

It shakes wildly when I run on the peanut shaped planet. Collision problems?
0

Share this topic:


  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users