Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (517)
Games in Android Showcase (123)
games submitted by our members
Games in WIP (578)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  How would you implement a stair system  (Read 2198 times)
0 Members and 1 Guest are viewing this topic.
Offline Kronos

Junior Duke


Medals: 1



« Posted 2013-06-15 11:42:41 »

Hello everybody,

I am working on a platformer without jumping.... however. I want to go to different floors using stairs like in a house. How would you manage this.
At the moment I got a StairContainer with an ArrayList<Stair> and checking if the up/down button is pressed. A stair is more or less a rectangle. So I check an intersection. This is semi-cool, because I need to position the rectangle very precisely. Going up is just y -= 0.2f * delta; plus x += 0.2f * delta;

I dont really like this method ,because it has lot of lacks, and might look very strange.

I would appreciate any help. Thanks in advance.

cheers, Kronos
Offline UprightPath
« Reply #1 - Posted 2013-06-15 11:50:59 »

Instead of checking for a collision you could always just check if the player is passing through some point in a certain direction and holding/pressing up. Then 'attach' them to the stair, which should have its own rules for left/right motion, even if it's just some sort of straight line, because you (probably) don't want your character to fall through the floor if he stops holding up/down.

Offline Kronos

Junior Duke


Medals: 1



« Reply #2 - Posted 2013-06-15 12:48:15 »

Hey there, thanks for your answer. How can I "attach" that guy smoothly to the stair, that it doesn't look so mechanicly.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline relminator
« Reply #3 - Posted 2013-06-15 13:22:50 »

Can you explain what "platforming without jumping" is?
Offline Kronos

Junior Duke


Medals: 1



« Reply #4 - Posted 2013-06-15 14:18:15 »

Actually there is a house with 4 floors, maybe the technical term platformer is wrong here. sorry Wink
Offline ReBirth
« Reply #5 - Posted 2013-06-16 02:23:15 »

What kind of stair? there's 2 kind on 2D platformer (I think the term is fit here). One is like what UpRightPath says. Other one is where you need no key press, the stair appears as terrain instead background.

Offline relminator
« Reply #6 - Posted 2013-06-16 05:12:34 »

Megaman stairs or castlevania stairs?
Offline Kronos

Junior Duke


Medals: 1



« Reply #7 - Posted 2013-06-16 09:04:16 »

castlevania as I can see from picture research Wink
Offline relminator
« Reply #8 - Posted 2013-06-16 09:58:47 »

I haven't implemented such ladders but this might work:

1. If a player is in a ladder tile...
2. get player tile pixel pos by player xpos - tilepos x tilesize
3. player ypos = tiley x tilesize - playertilepixel x slopegradient.


Sorry for the formatting as I'm using a phone to post.

I may try this logic later.
Offline numpad

Junior Newbie





« Reply #9 - Posted 2013-06-18 14:52:35 »

Another good thing would be to use states combined with those things above.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Kronos

Junior Duke


Medals: 1



« Reply #10 - Posted 2013-06-19 19:51:53 »

Thanks for the help. I think I got a good solution. I'll post it as soon I finished it Wink
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

DarkCart (18 views)
2014-10-31 21:44:48

DarkCart (23 views)
2014-10-31 21:43:57

TehJavaDev (40 views)
2014-10-27 03:28:38

TehJavaDev (31 views)
2014-10-27 03:27:51

DarkCart (45 views)
2014-10-26 19:37:11

Luminem (27 views)
2014-10-26 10:17:50

Luminem (31 views)
2014-10-26 10:14:04

theagentd (36 views)
2014-10-25 15:46:29

Longarmx (64 views)
2014-10-17 03:59:02

Norakomi (62 views)
2014-10-16 15:22:06
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!