megatronx wrote:Nesteris wrote:megatronx wrote: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.
-Global 2D "ArrayMap" to keep map data, set to Global. (We will be using "0" & "1" to tell events which rooms are discovered)
- MiniMapRoom sprite
-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.
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:
|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"
|- Set Local Var "X" to loopindex("X")
|- Set Local Var "Y" to loopindex("Y")
||"ArrayMap" compare at XY: "X : LocalMapX + Room.PositionX" & "Y : LocalMapY + Room.PositionY" = to 0:
||- 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.
|"Player" is overlapping Detector,
|-Set "ArrayMap" at "X: DetectorMapX" & "Y: DetectorMapY" to "1"
|On Key "for Map" pressed:
|- Show sprite MapBackground
||"ArrayMap" for each element XY
||"ArrayMap" current value = 1
||- 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?
Started working on it about an hour or two ago. Was busy with other stuff and left the forum on.