The Daily Click ::. Forums ::. Klik Coding Help ::. Slopes in 2.5d
 

Post Reply  Post Oekaki 
 

Posted By Message

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
27th June, 2009 at 07:31:39 -

... I'm guessing that noone knows how to do this ...

If you do happen to know, then post an example please.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
27th June, 2009 at 14:31:04 -

The way I'd be tempted to do it would be to make it work like a normal 2D game, with the backdrops used for collision detection beeing hidden (alpha channel to 1) and your actual graphics over these and not checked for collision.

I'd make all the gravity and movement happen normaly for the player and enemies, then add the Z offset value(dept) to their Y position just for the visual representation.

This way, you could code the slopes like you would normaly, and make them work no matter the angle.

Edit[If you think that the alpha channel to 1 isn't a good idea(since it's technicaly still visible), you could use the overlay redux object instead for collision detection]

Edited by Spitznagl

 
...

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
27th June, 2009 at 17:52:26 -

Thank you for the quick response. That would work for MMF2, but I forgot to mention that I'm looking for a TGF1 solution so that everyone will be able to use it and to reduce speed issues. You'd basically need to know how to do what I've already done in the 2.5d project and then some. Unfortunately TGF1 has no alpha channels.
Overlay redux? .. is that an extension for TGF1 or only MMF?


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
27th June, 2009 at 18:24:39 -

By alpha channel, I meant in a drawing software. Set the layer opacity to 1 and save as a .png. It's the only way I know to hide a backdrop. It's not that important since, technicaly, they should be hidden by the real graphics anyway.

Overlay Redux should work in TGF
http://ext.neatwares.ath.cx/search/overlay/
It check for the RBG value at a certain coordinate. So you could make a 2D version of your level in a color wich you wont use anywhere else, and use it for collision detection.

A normal set of backdrops would do just as fine though, so I don't see why it couldn't be done in TGF1. Just make everything work like a sidescroller, then at the very end of the events, move every creatures/moveable object/or whatever on the Y axis by their Z_offset value. At the very beginning, move them back in 2D position to move them and check for collision on the hidden backdrops. Repeat

 
...

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
30th June, 2009 at 16:34:41 -

Hmm .. that's the same extension that Andos' used in those light/shadow examples. Overlay Redux seems to have many uses.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
30th June, 2009 at 16:41:43 -

From the help file:

"The Overlay Object really has a two-fold purpose. Originally, it was designed to be an invisible "overlay" of your frame. The colors in object could be used to indicate particualr zones in your level. You could make certain things happen when objects were in those zones (over those colors). The second purpose, which was never the intent of the object when Cragmyre originally made it, is to be a graphical object. By turning visibility on, the Overlay becomes visible as a background object. Because it is a background object, any drawing to the screen or moving of its position forces the whole screen to be redrawn, which can be slow, so try to use the graphical features of this object efficiently."

 
...

DMT



Registered
  18/06/2009
Points
  150
30th June, 2009 at 16:59:44 -

It does have a lot of uses, but you could always use the semitransparency ink effect on the backdrop to an integer of 128.

 
I am no longer not a taco.

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
30th June, 2009 at 17:11:26 -

Damn
I didnt remember that backdrops had ink effects, probably because theyre not present in the event editor.
I feel like a noob

 
...

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
30th June, 2009 at 17:51:01 -

You can get the height of the player when he is on the slope using the Pythagorean Theorem.

http://i9.photobucket.com/albums/a62/Peblo/quick.png

Assuming you are already giving the player an artificial height based on what platform he is on, you will need to add the red line (A^2) to the artificial height. So, after you figure out the other two numbers, then it'll be
(redline)+(current height) = new height

The blue line (b^2) is how far the player is into the slope, which can be adjusted if the perspective isn't correct, such as correct isometric.

The green line is how far the player is up the slope. You'll need the degree in which the slope is ascending at. For example, in my example, it rises at 45 degrees.
http://www.mathsisfun.com/algebra/trig-solving-asa-triangles.html
You'll have the 90 degree angle and the 45 degree angle and the blue side to figure it out.

In fact you probably could skip all the above steps if you know what you want out of
http://www.mathsisfun.com/algebra/trig-solving-asa-triangles.html



 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
30th June, 2009 at 18:41:32 -

Thank you Peblo, but all I got out of that was Math Math Math Math Math bleh, and a question that comes to mind, "Why would one of the two angles need to be anything other than 90º?"

So, umm ... could you explain in a less statistical manner? I'm a bit too thick-headed to know what all that stuff has to do with actually making the slopes work in 2.5d.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
1st July, 2009 at 00:09:03 -

In normal programming, all you use to make games is math math math. MMF takes tons of that needed math away, when you're working in 2D. You're working in 2.5D though and so you'll have to use math. Sorry!

The start point for one line is one edge of the slope, and the end point for the line is how far the player is from that edge, when the player is supposed to be on the slope. The first angle is the slope of which the slope rises (rise/run), in degrees. The second angle is 90 degrees, and the 3rd angle = 180-90-(first angle). You can use simple trig to find the artificial height of the player's position when on the slope. You can then implement some slight height tolerance (like 3 pixels) so the player can move up and down the slope.

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
1st July, 2009 at 01:54:00 -

I would perhaps not go with the math way if you find it too dificult and use the Overlay object. The good thing about using colours for collisions is that you can simply use a gradient for a slope

 
n/a

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
1st July, 2009 at 04:07:01 -

With no math:
http://www.create-games.com/download.asp?id=7828

 
...
   

Post Reply



 



Advertisement

Worth A Click