dabyx
Processing Plant
Posts: 27
|
Post by dabyx on Apr 6, 2024 11:49:34 GMT
Hello everyone,
I have been trying to use adventure mode for the first time and I assumed I could 'teleport' to random screens using LET SCREEN and then continue using the map.
However I'm having issues with this.
:For example, say I have a simple left-tp-right map from 0 to 10
I am currently on screen 0
I use LET SCREEN 5
The current screen changes to 5
the SCREEN variable tells me I am on screen 5
But then if I use SCREENRIGHT the player does not go to screen 6 but screen 1.
So it seems the map routine still thinks I am on screen 0 even though the screen variable tells me otherwise.
Is this just not possible in adventure mode?
Or is there something else I should be doing?
Many thanks
EDIT: I'm currently using DATA READ and not SCREENLEFT/RIGHT as a workaround for now but still curious if 'teleporting' to other screens or areas of the map can still make the map work from there.
|
|
|
Post by ramon on Apr 6, 2024 13:35:26 GMT
The screen change is resolved when a new gameloop starts. The scripts for all events will have to be executed. If you have screen breaks in several events, I advise you to change them and manage them from a single event. for example mainloop2.
|
|
|
Post by ramon on Apr 6, 2024 13:38:14 GMT
Exit command after jumping screen is a good idea too.
|
|
dabyx
Processing Plant
Posts: 27
|
Post by dabyx on Apr 6, 2024 13:56:45 GMT
The screen change is resolved when a new gameloop starts. The scripts for all events will have to be executed. If you have screen breaks in several events, I advise you to change them and manage them from a single event. for example mainloop2. Thanks Ramon, you are always such a great help! I do have all screen changes (let screen and screenup eg) in one sprite event. (Type 6 currently) Honestly I haven't used Exit much as I don't really understand when or why to use it.
|
|
mas
Processing Plant
Posts: 28
|
Post by mas on Apr 6, 2024 14:06:51 GMT
When I've changed screens in the past it's usually been followed by a redraw to clear the play area and ensure the correct screen is drawn and I've not noticed issues with screenleft/ screenright - so I have to assume the redraw resets the game map?
As it's the player being moved I usually put it in the player sprite event block.
Then I 1 / detect the move 2 / set the new X and Y position for the player sprite 3 / change the screen to the new location 4 / redraw the screen
Like Ramon says, the change isn't immediate; when I first tried this out I saw sprites appearing on the new screen that shouldn't be there (that came from the original screen) Since ensuring I do a redraw, it appears to have gotten rid of that issue. And I've not had problems (that I noticed) with screenleft and screenright)
If you use the mainloop2 idea, you could set a global variable to trigger the move; so the move could be initiated by anything you want. I usually have the player trigger it, but there's no reason why an enemy sprite or a timer trigger couldn't set it off).
mainloop2 events trigger after all the other sprite events, so nothing else should be writing to the screen or trying to detect something and it is an ideal place to stick something that has to occur before the other events are checked again.
Good luck!
|
|
dabyx
Processing Plant
Posts: 27
|
Post by dabyx on Apr 6, 2024 15:32:50 GMT
Ah that might it be then. I've been using restart (which normally would include a redraw?)
I have no problems with incorrect sprites appearing or the wrong room appearing when I use LET SCREEN but in using LET SCREEN the map still thinks it's at the previous screen. I don't really get it 😅
I'll try redraw as well/instead thanks.
|
|
dabyx
Processing Plant
Posts: 27
|
Post by dabyx on Apr 6, 2024 19:46:32 GMT
No luck. Still an issue.
I'll have to work around it for now by not using adventure mode.
Just to clarify, say there are screens 0 - 5 going left - right 0-1-2-3-4-5
Say I am on screen 1 I SCREENRIGHT and it's fine, I go to screen 2
But if instead I LET SCREEN 3 I go to screen 3, screen 3 is correct and sprites are correct but If I then SCREENRIGHT
I do NOT go to screen 4 but screen 2 (The map thought I was still on screen 1...)
|
|
mas
Processing Plant
Posts: 28
|
Post by mas on Apr 7, 2024 1:36:34 GMT
That is really odd. I wonder if it's a bug in adventure mode; especially as it works in regular mode. Maybe there is something about adventure mode that's clobbering the map data or not persisting the correct location. I wonder if instead of teleporting to the screen if you trigger a loop of screenleft, right etc. To get you to the screen. Kind of a "instead of teleporting to screen 6 that is 4 screens to the right, we'll repeat screenright 4 times" (or whatever the route is to the screen)
|
|
|
Post by ramon on Apr 7, 2024 11:35:32 GMT
The exit command is the end point of your player's script. If you insert it in your scripts, they will jump to the following scripts, so the code you have written after the exit command will have no effect. you can type LET screen = 5 , place your stuff, make your changes, and then type EXIT. The AGD motor checks if there is a jump and executes it. This jump occurs when the script is finished, not during the course of the script.
|
|
dabyx
Processing Plant
Posts: 27
|
Post by dabyx on Apr 8, 2024 8:08:20 GMT
That is really odd. I wonder if it's a bug in adventure mode; especially as it works in regular mode. Maybe there is something about adventure mode that's clobbering the map data or not persisting the correct location. I wonder if instead of teleporting to the screen if you trigger a loop of screenleft, right etc. To get you to the screen. Kind of a "instead of teleporting to screen 6 that is 4 screens to the right, we'll repeat screenright 4 times" (or whatever the route is to the screen) I'm very inexperienced so it may be just that Adventure mode isn't supposed to be used with Let Screen 'teleporting'. I just assumed you could. That could be an idea. Thanks 🙂 I was thinking of just changing to not really use adventure mode.
|
|
dabyx
Processing Plant
Posts: 27
|
Post by dabyx on Apr 8, 2024 8:10:01 GMT
The exit command is the end point of your player's script. If you insert it in your scripts, they will jump to the following scripts, so the code you have written after the exit command will have no effect. you can type LET screen = 5 , place your stuff, make your changes, and then type EXIT. The AGD motor checks if there is a jump and executes it. This jump occurs when the script is finished, not during the course of the script. Oh that makes perfect sense to me now thank you Ramon! 😁 You make using MPAGD easier and more fun 👍👍
|
|