Automapping Layouts to a pause screen map

0 favourites
From the Asset Store
Is a circular loading screen with code ready to use. No Animation.
  • Anyone have the time to come up with a way to create an event sheet that automaps the game?

    I was thinking of setting up a global variable for each room that was basically a yes or no value which then gets a sprite representing a room visible or creates it.

    Anyone who's already done it care to share or explain in detail?

  • I think you'll need to be more specific as to what you actually want

  • Is it a top-down game or sidescroller? If top-down I'd say just assign each room to a 2D array position (eg:x and y, then set the value to 0 or 1 for visited or not) and then you can do a loop on the pause screen to create the map.

    Also is your map randomly generated? That might be part of the difficulty

  • It's a 2D Sidescroller (Metroidvania), and a fixed map.

    Sorry I forgot to mention that.

  • sqiddster

    I need a map to be generated based on the rooms the player has entered so far.

    Having rooms that the player has been in show up on the map, while others that haven't been entered not shown/genereated in the map yet.

  • 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.

  • 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.

    I will try that, sounds simple enough. Thanks.

    (Btw it's not a mini-map but a map in the pause screen which is isolated from the game, i.e. the game saves state, goes to the pause screen and when you exit the pause screen the state is loaded).

  • 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?

  • > 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?

    No, But I'm writing for you post with instruction. But just tell me, cause I didn't understand, do you have each room on different layout, or are all room on a single layout? Also, are the sizes of the rooms based of screen size like in metroid, or are the sizes irregular?

  • > 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,

    • 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.

    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?

  • >

    > > 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,

    - 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.

    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?

    Started working on it about an hour or two ago. Was busy with other stuff and left the forum on.

  • megatronx

    Here's the screencap, it's not working though.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Still not working:

  • Tried it without originalwindow, still not working.

    The minimap sprites aren't being created. Not sure if anything else isn't working from what I can tell.

  • send me your capx and I will look in to it

    EDIT@ ! Loop for X and Y must be in the same events!

    EDIT@ So just move FOR Y in to the same events block as FOR X, and remove duplicated actions

    EDIT@ Send me capx and spreadsheet

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)