Moving Maps
-
Hi, I'm messing with Tilemaps for the first time, and I have a question.
Without using the spritecamera, is there any way to Scale and Move the tilemap? -
@Retrocade_media I'm using the sprite camera in my game-- I just update its X/Y coordinates as the player moves, but it could just as easily be moved independently. Is there a reason that won't work for you? Just trying to grasp the problem better.
-
@Spacemario Because the way my border is set up and how all the sprites spawn
-
@Retrocade_media Oh, gotcha'... you have game-specific requirements! I guess one of the Fuze team members can chime in if there's another way :)
-
So I figured out that when you do drawmaplayer you can scale and move it then and there via a vector or a float. Is there a drawmapcollision function or something like that? Cause collision doesn't scale with the map for some reason
-
OK so it looks like there are some undocumented overloads. I assume that you have found on of those. Can you show me the code please and I will investigate? I wasn't even aware of these myself so it is possible that they are unsupported.
-
@pianofire you can see what all this supports by doing drawmaplayer(gibberish)
-
Thanks I'll get back to you
-
@Retrocade_media said in Moving Maps:
Cause collision doesn't scale with the map for some reason
I can understand the confusion, but the collision functions don't know where you've drawn the map. Map collision and map drawing are two entirely separate processes that have no relation to each other. The sprite camera is intended to be used in most cases to zoom in/out and follow the player around the map. The collision should always line up and be consistent if you use it.
drawMapLayer on the other hand is intended for more specialized effects, such as parallax background, minimap drawing, or whatever else you can think of! If you use this, you'll have to make sure your gameplay is still taking place in "map space." For example, if you have a collision box at (100, 100) it will not move no matter where your map is drawn. It's always going to be at (100, 100) and will always be the same size for collision purposes.
OK so it looks like there are some undocumented overloads. I assume that you have found on of those. Can you show me the code please and I will investigate? I wasn't even aware of these myself so it is possible that they are unsupported.
Sprite and map functions that take positions, scales, and colors as parameters typically have overloaded definitions that instead support vectors in the place of those float values.
-
@Willpowered That is really good information, thank you! This should be added to the hints and tips forum
-
To be fair, it should be in the help. And now we know, it can go in the help ;)
-
@Retrocade_media said in Moving Maps:
So I figured out that when you do drawmaplayer you can scale and move it then and there via a vector or a float. Is there a drawmapcollision function or something like that? Cause collision doesn't scale with the map for some reason
Just a quick question:
Are these overloads safe to use? They won’t get deprecated in a newer release? Are they even being added to the Help page, perhaps?
-
@vinicity said in Moving Maps:
drawmaplayer
This is from the latest (not released yet) help file:
drawMapLayer( layer ) drawMapLayer( layer, x, y ) drawMapLayer( layer, x, y, rotation, scale ) drawMapLayer( layer, location ) drawMapLayer( layer, location, rotation, scale ) drawMapLayer( layer, location, rotation, scale, tint )
-
Thanks!
Does the scale take a vector as well, or is it always a float (proportional scaling)?
-
@vinicity It only says float:
{code:layer} Integer - Index number of the map layer to draw (zero is the first)
{code:x} Float - Horizontal screen position of the layer origin point
{code:y} Float - Vertical screen position of the layer origin point
{code:rotation} Float - Rotation applied to the map layer in degrees or radians
{code:scale} Float - Scale factor applied to the map layer
{code:location} Vector - Screen location vector in 2 dimensions { x, y }
{code:tint} Vector - Colour applied to the map layer in RGBA format { red, green, blue, alpha }, or colour n
-
I think we'll need examples for all of these because at the moment I believe drawLayer(x,y) respects spritecamera and I wouldn't know what the others do!
-
The way to get my collision map working undocked and docked and making use of 1920x1080 on TV was by applying
setMode(1920,1080)
. In my past projects, this decreased the performance when undocked, so I did not use setMode() but scaled the coordinates. And for my current project the performance does not seem to be an issue. But is there another way to achieve this? I mean @Willpowered already answered this clearly, just want to make sure, I understand the application of the info.