Automapping Layouts to a pause screen map

Discussion and feedback on Construct 2

Post » Sun Apr 12, 2015 12:34 pm

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?
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Sun Apr 12, 2015 1:14 pm

I think you'll need to be more specific as to what you actually want
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,679

Post » Sun Apr 12, 2015 3:04 pm

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
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit
B
113
S
39
G
17
Posts: 2,184
Reputation: 19,217

Post » Sun Apr 12, 2015 9:42 pm

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

Sorry I forgot to mention that.
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Sun Apr 12, 2015 9:44 pm

@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.
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Thu Apr 23, 2015 9:55 am

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.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
85
S
27
G
21
Posts: 1,968
Reputation: 19,165

Post » Thu Apr 23, 2015 10:41 am

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.


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).
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Thu Apr 23, 2015 11:10 am

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?
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Thu Apr 23, 2015 12:47 pm

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?


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?
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
85
S
27
G
21
Posts: 1,968
Reputation: 19,165

Post » Thu Apr 23, 2015 1:56 pm

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.

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?
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
85
S
27
G
21
Posts: 1,968
Reputation: 19,165

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Brendan2007 and 6 guests