How to adjust a size of a scene? The default one is too big for me. And after I centered a camera on the player the floor is now in the middle of the screen when I preview the game with empty spaces at the bottom and at the left of the screen. I would like to see the beginning of the grass floor tiles at the low left corner of the screen. How to achieve it?
You should change the default screen size of the project:
1 - Right click on the project in the “Project manager window” (the window where you add/select scenes, external events, etc.)
or 2 - Change it through events: for example “At the beginning of the scene” ===> Change the size of the window to 300;200 (No stretch, other way you will see the big scene stretched in a smaller window)
Tip: You can activate a mask (In the scene ribbon) to darken(?) the scene except the zone where the camera will look at, useful to see the scene/camera size and resize them
Finally, this topic should be at “Help for game creation”, I think
I learned to change the screen size of the project now. But with mask there is probably some bug - it is useless for me because what I see inside it during editing is not what the screen looks like during preview. I can relay only on coordinates of the objects (the top left corner of the screen is (0, 0)). Maybe it’s because I still not good with choosing camera views.
Yeah, to move the camera you have to use the events system
Note that move the mask in the scene don’t move the initial position of the camera (the mask is only a helper)
For example, if the camera should follow a Player over the Grass Floor, you can use the Camera action: Follow an object with limits
I have this scene:
Add this event (left and bottom limits from the grass position, zero and 2000 as big limits (bigger than the world), I mean “no limit at right and top”):
And the result:
Thanks! Great help! I wish it would be mentioned in the tutorial itself. (Kind of nervous to mess up with wiki tutorial myself without any experience).
Found a little easier way to do this.
- Adjust window size. By default is 800x600. (Project manager, Right click on “Project”, choose “Edit the property of the game”, change window width and height to 640x480, for example.)
- Turn on the Mask (Button on top when tab “Scene” is activated). It will show your working space limited by the chosen window size.
- In the Scene editor press “Return to the initial position (0;0)” to be sure that the coordinates of your chosen window and your working space are the same.
- Activate the grid (Button “Grid” at the top). Adjust the cell size to used sprites size, by default is 32x32 (Button “Edit the grid”). Activate snapping to the grid.
- Then you can add objects to the scene and see where they will appear during preview of the game.
- When the scene is bigger then window size, for example 2000x480, to follow the Player choose “Events” tab, add event without conditions, add action “Center camera on the object within limits” and just type in the coordinates of your scene (left top corner 0,0 and right bottom corner 2000;480). You can use negative numbers too for left and up directions from the 0,0 point.
The size of the scene is unlimited, I think (not just 2000x2000 as it was mentioned before).
Thanks for your detailed message, I add a link to this thread in the tutorial: wiki.compilgames.net/doku.ph … the_player
the camera already at the center,but won’t follow the plaayer .__.
Ohhhh men… I didn’t read it carefully enough
1- When I said 2000 as a big limit “bigger than the world” I mean “bigger than your world” (the right limit of your own scene), as you (komenkanto) say: GD has not any scene’s size limit at all
2- I set a top and right limit because I don’t know if GD take the limit as “infinite” if I let it blank (I can’t test it now, but probably GD read the blank parameters as zero).
3- I said you have to resize the project window (I didn’t pay enough attention), you haven’t to change the window size necessarily but you have to change the camera size (you can change both window and camera size to get the desired size/zoom/stretch effect)
Maybe I’ll write some kind of mini-tutorial for cameras/follow with limits, to correct the confusion I’ve created… I’m sorry
Could you take a screenshot from the “camera follow” event?, or check expressions (object’s name, limits numbers)
I think you don’t get the “limit” concept properly, the limits are not the camera size, the camera will (always) follow the player but it can’t “exceed” the limits, check the pictures
The camera is centered on the object:
The player fall, the camera try to center it, but can’t cross the bottom limit:
Then the player walk to the left, the camera follow it, but without crossing the left limit:
In your image I see very small limits, if the limit’s rectangle is smaller than the camera’s size the camera can’t find some place where it doesn’t cross the limits (yeah, GD explodes internally ), probably GD ignore the event to avoid errors, then if the event is not readed, the camera doesn’t follow the player