> Easiest way would be to have detectors size of the screen, throughout the whole layout, and on overlapping once, you add it's position, divided, layout.width/detector.width, to array, from which you create a minimap.
>
Just tried it, I'm shit at using arrays. I honestly have no idea how to set that up, didn't work for me :I need to log the map values in Layout A, and then make the map in Layout B, they're completely independent from each other so I'm having a lot of trouble.
The only things that can interact from one layout to the other and store values from layout B to A are global, no save objects, otherwise they get reset when you exit layout B if you made changes in the pause screen.
Anyone got enough time to make a demo capx?
Ok. So you have your rooms on different layouts then? Global array can't be saved? If global array can't be saved, then you got to export it in to ajax string first, then store it in dictionary under a key, so it should be savable ( I think ). Anyway, worry about saving game later.
If your rooms are on different layouts ( which i'm not sure is best solution for metroidvania tbh, but lets go with that ) then you'll need to do some work around, obviously. But really you should have started with map logic first, then proceed with room building refering automatically to array.
Anyway, metroid style of map where each room size is multiply of screen, in your case, would be done like this.
You'll need:
-Global 2D "ArrayMap" to keep map data, set to Global. (We will be using "0" & "1" to tell events which rooms are discovered)
-Dictionary,
-Detector sprite with "Persist" behaviour and variables "DetectorMapX" and "DetectorMapY", set to Global
-Sprite "Room" with variables "RoomPositionX", "RoomPositionY", Boolean "Cleared" set to false, "Persist" behaviour, and set to Global
- and a spreadsheet on which you can draw the positions of rooms on map, where 1 grid = 1 screen.
Instructions:
Place "Room" on each layout, and set its variables "PositionX" "PositionY" to numbers by referencing to the spreadsheet.
(Not sure if "OriginalWindow" will work. You might need to use just "Window." instead" )
On start of layout:
|Condition:
|For "X" From 0 To "floor(layout.width/OriginalWindowHeight)"
|For "Y" From 0 To "floor(layout.height/OriginalWindowWidth)"
[Add two local variables]
|Local Var "LocalMapX"
|Local Var "LocalMapY"
[then]
|Actions:
|- Set Local Var "X" to loopindex("X")
|- Set Local Var "Y" to loopindex("Y")
||Sub-Condition:
||"ArrayMap" compare at XY: "X : LocalMapX + Room.PositionX" & "Y : LocalMapY + Room.PositionY" = to 0:
||Actions:
||- Spawn Detector at position " X:LocalMapX *OriginalWindowWidth" " Y: LocalMapY*OriginalWindowheight" :
||- Set Detector size to "Width: OriginalWindowWidth, Height: OriginalWindowheight"
||- Detector: Set Var "DetectorMapX" to LocalMapX + Room.PositionX
||- Detector: Set Var "DetectorMapY" toLocalMapY + Room.PositionY
Event's after start of layout.
|Condition:
|"Player" is overlapping Detector,
|Trigger once
|Actions:
|-Set "ArrayMap" at "X: DetectorMapX" & "Y: DetectorMapY" to "1"
|-Detector: Destroy
Displaying Map
|Condition:
|On Key "for Map" pressed:
|Actions:
|- Show sprite MapBackground
||Sub-Condition:
||"ArrayMap" for each element XY
||"ArrayMap" current value = 1
||Actions:
||- Spawn sprite "MiniMapRoom" ( or whatever it is called; It's the object to display as room on MiniMap ) at "X: MapBackground.X+(ArrayMap.CurX*MiniMapRoom.Height)" & "Y MapBackground.Y+(ArrayMap.CurY*MiniMapRoom.Width)"
Done! See if it works!
Edit@
Nesteris had a chance to glimpse trough this?