February 21, 2021 at 7:42 am #34632MarbyParticipant
We have not yet the functionality, to scroll the screen directly. However, we can make our hero invisible, massive increase the hero’s walking speed and after that teleporting him/her to a door, where the cut-scene for the scrolling should start.
I prepared a little test game in order to demonstrate this.
In that test scene we have a long dungeon. My test level (level2) has a size of 50×11 tiles. We also have two invisible doors, two invisible floor switches, an actor named “HeroCopy” and the hero. I placed the HeroCopy and the two switches beside the other elements, so that you can see them all.
- Entrance: You simply need the Entrance-door to enter the room from the previous room.
- CtrlCutScene: This switch will handle our complete cut-scene. Place it on the Entrance-door in order to activate it, right after the hero entered the room.
- CutSceneEnter: That door is used by CtrlCutScene in order to move the sceen.
- HeroCopy: Place this actor three tiles to the right. HeroCopy will be used to let the player think this is the hero, while we’re using the real (invisible) hero to scroll the screen.
Two of the shown elements you do not need for your scrolling effect:
- hero: The hero’s position can be ignored.
- ToTestingRoom: You’ll need this switch only to let the hero return to the previous room. Place it one step more left, as soon as you’re ready, to bring it into the right position.
All the magic is handled through the CtrlCutScene’s screenplay, which is the following:
hero change appearance to "[characters.segmentsheet$1000$char32x48.segmentdiv,char.animator]" HeroCopy becomes active hero walk ability max speed becomes 15 hero walks to 10, 0 hero walks to 10, 0 hero walks to 10, 0 hero walks to 10, 0 hero walk ability max speed becomes 1 hero walks to 0, 2 hero walks to 0, -2 hero walks to 0, 2 hero walks to 0, -1 hero walk ability max speed becomes 15 hero walks to -10, 0 hero walks to -10, 0 hero walks to -10, 0 hero walks to -10, 0 hero walks to 0, -1 hero walk ability max speed becomes 4 HeroCopy walks to 0, -1 HeroCopy becomes inactive hero change appearance to "[characters.segmentsheet$56$char32x48.segmentdiv,char.animator]" hero teleports to door "Entrance" at "level2" CtrlCutScene becomes inactive
Yes, this is a lot! I’ll explain it step by step now:
hero change appearance to "[characters.segmentsheet$1000$char32x48.segmentdiv,char.animator]" HeroCopy becomes active
If the hero enters the level, we have to make him invisible. Therefore, we change his appearance to a segment sheet, which does not exist. I don’t think we will ever have 1001 characters in RPG Playground (the index starts with 0; index 1000 is character 1001). Therefore, I guess we’ll fine with index 1000. (@deWITTERS: Of course, I do not exactly know, if this could be a problem in the future. Please comment this, if there is a problem with it.)
hero walk ability max speed becomes 15 hero walks to 10, 0 hero walks to 10, 0 hero walks to 10, 0 hero walks to 10, 0
Next, we’ve to increase the speed of our hero to a high value. This will make the scrolling effect more fluently. The “hero walks”-commands will let the hero walk 10 tiles to the right each. You may wonder, why I’ve not just used one line with 40 tiles to walk. I thought the same. However, at the current state of the engine, the hero will <b>not walk at all</b>, if the amount of tiles to walk is too big. Therefore, I used four programming lines instead of one.
hero walk ability max speed becomes 1 hero walks to 0, 2 hero walks to 0, -2 hero walks to 0, 2 hero walks to 0, -1
The next problem is, that we’ve got no delay command so far. The programming lines above will simulate a delay command. We just let the hero walk very slow down and up and down and up again. The last programming line only lets him walk one tile upwards. For now, just keep this in mind. I’ll explain it soon.
hero walk ability max speed becomes 15 hero walks to -10, 0 hero walks to -10, 0 hero walks to -10, 0 hero walks to -10, 0
Again, we set the hero’s walking speed to a very high value. So he rushes to the left until he reaches the starting position.
hero walks to 0, -1
However, the hero is looking to the left now. Remember, that we previousely let him walk only one step upwards instead of two. This is why. In order to make him look upwards, we just let him walk another step into that direction.
hero walk ability max speed becomes 4
We have to set the hero’s maximum speed to normal. Usually, it is 4.
HeroCopy walks to 0, -1 HeroCopy becomes inactive
The hero still is invisible. For the player he still is standing at the door. We’ll let him “enter” the room now. Let the HeroCopy walk one step upwards in order to give the player the illusion the hero enters the room now. After the walking command has been finished, we don’t need the HeroCopy anymore and deactivate it.
hero change appearance to "[characters.segmentsheet$56$char32x48.segmentdiv,char.animator]"
We need to make our hero visible again. For the character in my test game the index 56 is correct. In order to find the correct index for your hero, open the screenplay of CtrlCutScene, select the line, where to enter the command and use the “Insert action”-button. Select the following, in order to change the hero’s appearance to the correct one:
- hero changes appearance to “…”
…and click on the correct character image.
hero teleports to door "Entrance" at "level2"
Since the hero looks to the right direction, we can teleport him to the correct position. You could try to first teleport him and than make him visible. However, the engine sometime seems to be a little pettish, when it comes to a teleport. Perhaps, even this will work. Just try it.
CtrlCutScene becomes inactive
As a last command in the screenplay of CtrlCutScene we’ve to disable CtrlCutScene itself. In my tests this worked even after the teleport command.
That’s all, folks!
Hope, this helps!0February 21, 2021 at 8:10 am #34646deWiTTERSKeymaster
Cool hack! The segmentsheet 1000 is definitely undefined behavior, and I really have to debug it to see if it would cause any problems.0February 21, 2021 at 12:18 pm #34653MarbyParticipant
Thank you for commenting this. I’m looking forward to read about your debugging results for this.0
- You must be logged in to reply to this topic.