Post new topic    
Metal King Slime
Send private message
A question about diagonal stairs 
 PostThu Apr 26, 2012 11:33 am
Send private message Reply with quote
Crikey but I'm asking a lot of questions...

Well, here's the scenario:



I've got diagonal stairs, and they can slant either way. So when the hero enters point A, he not only moves West with each step, but North as well. I've figured out how to make the hero move diagonally (MOVE HERO TO etc...) but it doesn't really achieve the effect that I want. What I have working now is, whenever the hero touches point A, a script takes control of the hero and walks the sprite diagonally North West. When the hero touches point B, another script takes over and walks the hero diagonally SE.

Is there a clever way to make it so rather than taking control from the player, the script checks what direction the player is moving the hero, and either move the sprite North or South?

I was considering using zones (what is it with me and zones anyway?) for different staircases. So for this type of stairway, it would be Zone A. A stairway going in the opposite direction would be Zone B. The script would then check what type of zone it is, and what direction the hero is going, and then move the hero accordingly.

What I'm not too clear on though, is how to go about doing that without using a SUSPEND HERO and moving the hero accordingly without it getting all fudged up.

Thanks in advance!
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
Metal Slime
Send private message
 
 PostThu Apr 26, 2012 12:41 pm
Send private message Reply with quote
I've said this before, and I'll say it again, your graphics blow mine away!

I use something similar to this:

Code:
script,upleftstairs,begin
   set tag (tag:stairs,on)
   suspend player   , suspend hero walls
   walk hero (me,up,2), walk hero (me,left,2), wait for hero (me)
   set tag (tag:stairs,off)
   resume player , resume hero walls
end

script,uprightstairs,begin
   set tag (tag:stairs,on)
   suspend player   , suspend hero walls
   walk hero (me,up,2), walk hero (me,right,2), wait for hero (me)
   set tag (tag:stairs,off)
   resume player , resume hero walls
end

script,downleftstairs,begin
   set tag (tag:stairs,on)
   suspend player   , suspend hero walls
   walk hero (me,down,2), walk hero (me,left,2), wait for hero (me)
   set tag (tag:stairs,off)
   resume player , resume hero walls
end

script,downrightstairs,begin
   set tag (tag:stairs,on)
   suspend player   , suspend hero walls
   walk hero (me,down,2), walk hero (me,right,2), wait for hero (me)
   set tag (tag:stairs,off)
   resume player , resume hero walls
end

To friends long gone, and those I've yet to meet - thank you.
Slime Knight
Send private message
 
 PostThu Apr 26, 2012 2:27 pm
Send private message Reply with quote
I'll have to confirm that I'm correct on this, but I believe you can use "suspend player" and still check for key presses. So, you could have it that, when the player is on the stairs, it suspends the normal input, and checks for the left and right arrow keys; if the left arrow key is pressed, it would walk him left 1, and up 1 simultaneously (i.e. - do what Fenrir showed and don't put a wait in between those, and you'll get diagonal movement, I believe). Likewise, if the right arrow is pressed, it would walk the hero right 1, down 1. Reverse it for the other staircases. Something like this may work as you want it (free control, but with diagonal movement, on the staircases), but I think you'd also need to have a key check to open the menu, or else the menu functions would be disabled on the stairs (not sure how big a deal that is to you).
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
Metal Slime
Send private message
 
 PostThu Apr 26, 2012 4:12 pm
Send private message Reply with quote
I haven't tested any of this, but I have a feeling that this will also need to worry about repeated key input, and the player holding down the key (most likely scenario). You'd need something like
[pseudocode]
Code:

suspend player
if(hero is walking == false),then
 begin
  if(key is pressed == direction),then
   (walk hero diagonally)
  similar for other direction
 end

Also the final step from the stairs back onto normal ground might need some special handling.
I am Srime
Metal Slime
Send private message
 
 PostThu Apr 26, 2012 8:11 pm
Send private message Reply with quote
Confirming what Harlock has stated.

Fen's script is fine. I don't think the player will mind, but if you must allow control...

MY TURN MY TURN!!!

Code:


suspend player

while (stairs) do (

##control movement for each direction
if (keyispressed(key:left)) then (
put hero ( me, hero pixel x (0) + x slope speed, hero pixel y (0) + y slope speed )
)

##have checks for when they reach the bottom or top
if (x==x destination && y==y destination) then (stairs:=false)

wait (1)
)

resume player

Liquid Metal Slime
Send private message
 
 PostThu Apr 26, 2012 8:38 pm
Send private message Reply with quote
Going on experience I can tell you that making manually controlled staircase movement is an exercise in masochism, especially if you have trailing party members. Heck, any kind of staircase control is painful if you have trailing party members.

Your stairs look simple to navigate, but I can warn you in advance that, until the OHR can function fully on pixel movement rather than tile movement (where you can press the "use" key on an NPC and still get a result in spite of being misaligned with the tile), you'll want to avoid any slope that isn't 45 degrees or has more than one-tile thickness. I once spent three days and initiated the help of James and TMC trying to get an irregular slope to work in a manner like you want, and none of us could get it perfect. In the end I had to give control back to the plotscript just to make sure the game was still playable.

You may want to keep the stairs plotscript-controlled if you want to avoid premature balding.
Place Obligatory Signature Here
Liquid Metal Slime
Send private message
 
 PostThu Apr 26, 2012 8:57 pm
Send private message Reply with quote
Pepsi Ranger wrote:
I once spent three days and initiated the help of James and TMC trying to get an irregular slope to work in a manner like you want, and none of us could get it perfect. In the end I had to give control back to the plotscript just to make sure the game was still playable.

You mean that sandy underground slope in Tightfloss Maiden? I remember that, and the fact that my walking was on autopilot didn't bother me a bit. It's just a touch of cinematic coolness, like the grappling hook and see-saw areas.
The same effect could be applied to BMR's stairs and I wouldn't care much. Just make sure that all of your slopes are straight, simple, and without obstacles and I'm sure some people won't notice. Or you could make it overt, and we still wouldn't care. I'm now thinking of the escalators from Earthbound. Those were, obviously, on auto-movement, and there were even enemies waiting at the end of some of them. I didn't care, and in hindsight, it was actually quite fair since the enemies traveled in straight lines and would otherwise have been easy to avoid.
Basically what I'm getting at is that your game will never be perfect, especially where plotscripting is concerned, but don't let that stop you. Your game can still be terrific and fun even if you take some easy routes through the programming. Go for an automated script-based movement for your stairs.
Metal King Slime
Send private message
 
 PostFri Apr 27, 2012 6:16 am
Send private message Reply with quote
Baconlabs wrote:
You mean that sandy underground slope in Tightfloss Maiden?


Yes. I never did finish my script for those. I seem to have lost it.

BMR, looking at your tiles, it looks like you'll probably want the hero to walk straight for half a tile at the ends of the stairs before beginning diagonal movement.

From experience with Tightfloss Maiden: the problem with using walk hero is that it checks walls. You'll either want to have no nearby walls, or suspend hero walls while on the ramp, or use "put hero" directly. Of course all of these require using "suspend player".
Metal King Slime
Send private message
 
 PostFri Apr 27, 2012 8:29 am
Send private message Reply with quote
Thanks for the help everyone! I think I can make it work now. And looking at everyone's suggestions, it might indeed be best to just have the script handle the walking up the stairs. Considering all the other things I want to try to implement, it would be best to keep this one simple for now, hehe.

Thanks again!
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
Slime Knight
Send private message
 
 PostFri Apr 27, 2012 2:22 pm
Send private message Reply with quote
BMR wrote:
Considering all the other things I want to try to implement, it would be best to keep this one simple for now, hehe.


Totally. As long as you have a way of organizing what you have done / need to do in your game (even like a text file or something), you could always just mark it as something to go back and improve later, time and will permitting. Momentum is definitely important when making games ;_;
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
Display posts from previous: