Automapping Layouts to a pause screen map

Discussion and feedback on Construct 2

Post » Thu Apr 23, 2015 8:49 pm

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.

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.
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:06 pm

@megatronx

Image

Here's the screencap, it's not working though.
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:19 pm

Still not working:

Image
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:36 pm

Tried it without originalwindow, still not working.


Image

The minimap sprites aren't being created. Not sure if anything else isn't working from what I can tell.
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:38 pm

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
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
81
S
23
G
20
Posts: 1,952
Reputation: 18,131

Post » Thu Apr 23, 2015 9:50 pm

First image is based of my design, but I see a mistake: you must set variables LocalMap to
|- Set LocalMapX" to loopindex("X")
|- Set LocalMapY" to loopindex("Y")

Also place those local vars underneath loops and even more underneath create blank event where actions for those variables will be. Underneath that nest arraymap events

EDIT@ I've made mistake here
|For "X" From 0 To "floor(layout.width/OriginalWindowHeight)"
|For "Y" From 0 To "floor(layout.height/OriginalWindowWidth)"

should be
|For "X" From 0 To "floor(layout.width/OriginalWindowWidth)"
|For "Y" From 0 To "floor(layout.height/OriginalWindowHeight)"
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
81
S
23
G
20
Posts: 1,952
Reputation: 18,131

Post » Thu Apr 23, 2015 10:20 pm

There is another mistake :

||- 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)"

Width goes with X and height with Y. Was typing very fast . Sorry for that ( but you should know this anyway ;p ).

I'm making capx for you
Last edited by megatronx on Thu Apr 23, 2015 10:39 pm, edited 1 time in total.
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
81
S
23
G
20
Posts: 1,952
Reputation: 18,131

Post » Thu Apr 23, 2015 10:38 pm

There you go

https://drive.google.com/file/d/0B0jUjWN7LcQhQklOa0VXaGhUb2c/view?usp=sharing

Hotspots for Detector, MapBackground, Minimaproom have to be at 0,0, top left corner. You can modify the events if you want to start form other position, but that's the easiest. Also, take note of instances preferences.
Room Instance is there for you, to add coordinations of rooms, using top left corner of the room, when referencing to the spreadsheet. For example, from room the size of 4 screens located at : 12,10|12,11|13,10|13,11| , you will set Room variables to PositionX=12 and PositionY=10
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
81
S
23
G
20
Posts: 1,952
Reputation: 18,131

Post » Fri Apr 24, 2015 12:48 am

megatronx wrote:There you go

https://drive.google.com/file/d/0B0jUjWN7LcQhQklOa0VXaGhUb2c/view?usp=sharing

Hotspots for Detector, MapBackground, Minimaproom have to be at 0,0, top left corner. You can modify the events if you want to start form other position, but that's the easiest. Also, take note of instances preferences.
Room Instance is there for you, to add coordinations of rooms, using top left corner of the room, when referencing to the spreadsheet. For example, from room the size of 4 screens located at : 12,10|12,11|13,10|13,11| , you will set Room variables to PositionX=12 and PositionY=10


Thanks a lot, will remember to give credit to you for the map!
I'm definitely give this a good study and implement it into the game as well, I'll see if I can add another array which will set which animation for the mini-map (So they look like more details as rooms instead of pure boxes).

By hotspots you mean origin? Looks like it. I'll most likely leave that as is.

For example, from room the size of 4 screens located at : 12,10|12,11|13,10|13,11| , you will set Room variables to PositionX=12 and PositionY=10

What do you mean? Like I set the variables for each of the 12, 10, | 12,11 | 13, 10 | 13, 11| co-ordinates? I saw in the .capx it's just left as zeroes.

This is an immense help!

Anyway to get the room the player is in show in the mini-map?
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 » Fri Apr 24, 2015 1:04 am

@megatronx

I'm noticing that when I enter another layout, the mini-map gets kind of reset or something and the Minimaproom gets created on top of existing ones.
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

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: db3344, Tokinsom and 4 guests