Objects moving upwards when room revisited

L

lyra_bee

Guest
Hey guys,

I have a problem where in two rooms, the objects in them move upwards when the room is revisited. One room is a countdown and one is the main menu when you restart the game.

Please find attached the two examples, first one is the correct position lined up in the boxes and the other is the example where they have moved up.
I can't find anything in the code that would do this, so I thought maybe it was something to do with the camera but I can't figure it out.

Firstly before posting code, is this something that people have seen before?

Cheers,

Bee
 

Attachments

Nidoking

Member
I don't think there's anything anyone can say without seeing the code. There's nothing here to relate your problem to a similar problem even if someone else has seen it. We don't even know how you're determining where these graphics should be.
 

Nidoking

Member
Okay. I'm going to assume these are Draw events. What about the instances that these events are running in? Are they persistent? How and where are they created?
 

Tyg

Member
are your 2 room sizes the same size?
i don't think they are by the picture, better to keep one roomsize and stuff scales with it
when you go to the new room it slides over probebly because thoose are the exact coordinates it was told to be placed at
using giving coordiates say 100,200 will go to 100,200 of the room, giving relative coodinates is like 100,200 relative = x+100, y+100
your using DnD so instead of 0,0 use x,y and it will be drawn wherever it was dropped
the same as the second draw value, use x+97 instead of the screen coordinate 97, it will be drawn at the objects position +97
try unchecking the relative
hope that helps :)
 
Last edited:
I had this exact problem a couple of days ago. It turned out to be the vertical alignment setting of the text had been set to fa_middle somewhere else in the code and not set back to its default again. I'm using GML though, not sure how this is done in DnD.
 
L

lyra_bee

Guest
are your 2 room sizes the same size?
i don't think they are by the picture, better to keep one roomsize and stuff scales with it
when you go to the new room it slides over probebly because thoose are the exact coordinates it was told to be placed at
using giving coordiates say 100,200 will go to 100,200 of the room, giving relative coodinates is like 100,200 relative = x+100, y+100
your using DnD so instead of 0,0 use x,y and it will be drawn wherever it was dropped
the same as the second draw value, use x+97 instead of the screen coordinate 97, it will be drawn at the objects position +97
try unchecking the relative
hope that helps :)

It's the same room, which is the problem, so I think maybe it's changing in another room, is there a way of finding out the current room size of each room? although I haven't changed it in any of them afaik.
 
L

lyra_bee

Guest
Okay. I'm going to assume these are Draw events. What about the instances that these events are running in? Are they persistent? How and where are they created?
The instances are created on the instance layer in the GUI - just dragged the instance into the room.
 

Tyg

Member
whatever the layer is called does not make it GUI, they have to be drawn with the draw GUI event, which requires a draw_self and visibility checked on to be visible
if it has the 2 circles it is an instance layer and this is where objects go, you can call it GUI for layering arrangement, but its still an instance layer
its the draw event or method that determines if it goes to GUI, but it is a good idea to make an instance layer and group your GUIs together
Hope that makes sense

room_width and room_length to answer your question
you could also put the objects at the same spot and change the visibilty,
or use a common object and use the instances creation code(not to be confused with create event) and use persistant for moving in different rooms
or you can use one object and use change instance to change to another object
so several ways of doing it without changing rooms

it really depends on your game design, i personally like one object like a text output and changing the creation code say if you had a bunch of sellers
say one sells fish and one sells candy but they basically use the same seller code, but need different response
I usually make one room for for init, logo and any begining sequenece, another for the menu, game, i try not to flip rooms and let a controller object handle input and sequencing
if i really need a bunch of rooms i always make sure they are the same size for smooth transition
a bunch of different sized rooms is just not a good design approach in my opinon, gamemaker is pretty good at scaling between rooms
but you just make more of a headache with different size rooms and GUI will not scale like intended with different room sizes
but to correct you example you would have to calculate the gui position every time, room a width - room b width kinda stuff
it can be done but not very efficient
better to keep the objects in the same room and turn visiblity on and off or create the instance dynamically or change instances
or keep the the room sizes the same
if you want mini rooms you can always use viewports
Hope that helps :)
 
L

lyra_bee

Guest
whatever the layer is called does not make it GUI, they have to be drawn with the draw GUI event, which requires a draw_self and visibility checked on to be visible
if it has the 2 circles it is an instance layer and this is where objects go, you can call it GUI for layering arrangement, but its still an instance layer
its the draw event or method that determines if it goes to GUI, but it is a good idea to make an instance layer and group your GUIs together
Hope that makes sense

room_width and room_length to answer your question
you could also put the objects at the same spot and change the visibilty,
or use a common object and use the instances creation code(not to be confused with create event) and use persistant for moving in different rooms
or you can use one object and use change instance to change to another object
so several ways of doing it without changing rooms

it really depends on your game design, i personally like one object like a text output and changing the creation code say if you had a bunch of sellers
say one sells fish and one sells candy but they basically use the same seller code, but need different response
I usually make one room for for init, logo and any begining sequenece, another for the menu, game, i try not to flip rooms and let a controller object handle input and sequencing
if i really need a bunch of rooms i always make sure they are the same size for smooth transition
a bunch of different sized rooms is just not a good design approach in my opinon, gamemaker is pretty good at scaling between rooms
but you just make more of a headache with different size rooms and GUI will not scale like intended with different room sizes
but to correct you example you would have to calculate the gui position every time, room a width - room b width kinda stuff
it can be done but not very efficient
better to keep the objects in the same room and turn visiblity on and off or create the instance dynamically or change instances
or keep the the room sizes the same
if you want mini rooms you can always use viewports
Hope that helps :)

Ok so I read that a couple times, my rooms are deffo all the same size but from what you are saying it might be better to dynamically change stuff inside one room instead of changing rooms each time. I might be wrong with GUI, I was trying to be clever lol!

I'll have a read about viewports
 

Tyg

Member
it really depends on what your game design is, scrolling background, static, tile based,
like say, i have an adventure game and each room has a background or is a minigame then i would use separate rooms, my menu system is kept off to the side of the room and scrolls in when activated
so i need the menu to be persistant between rooms and room size to be compatable with each other

but say, i have a side scroller, tile based, then i would use one room large tiled background and the guis to stay put in one place like a score
then i would have the viewport at the desired game window and scroll it with the player movements, and maybe some special rooms offscreen like caves to warp into
and if i want a bigger game then i would add another room with maybe a different tile set, now im in the jungle

you dont need a room for each object, maybe a death room or cut scenes or different levels or a pause room maybe init(which can be done during the splash screen so the user doesnt have any delay before playing)
i don't like load screens, i think they loading can be snuck in without any user delay,
the menu could be in an init room and if kept persistant it doesnt even have to be GUi, just use a hotkey and activate/deactivate the visibility or keep it offscreen and fly it in
i usually start my games with a splash screen, then to a new/continue and options menu room, (this menu is not persistant) only needed when starting or restarting so i wouldnt want it in my game room
that also initializes stuff
then to the game which has a persistant menu, like pause where i want it to stay in game,
you can have stuff off screen (outside the grid) and bring them in when needed like menus
most of the time i have seen this problem is when GUIs are drawn with exact co-ordinates with different room sizes
if you want a GUI object like a score, make a draw_gui event and just draw_self and if you leave it there it will scale between rooms there is no need to resize it even if room sizes are different
which i think is bad practice, gamemaker automates a lot of stuff, most of the scaling problems i see are from poor planning at the beginning
and people try to override gamemakers scaling
thats when scaling becomes the problem

if you just drop your gui object on the screen gamemaker will scale it between rooms, it you then use its x/y instead of 500/20 the x/y will be scaled to the room size, the the 500/20 will be placed at thoose co-ordinates
so if your roomsize is different it will not match, if that makes sense
if you plan a little in the beginning like tilesets you can avoid a lot of headaches later

ill try to post a few pics of what im talking about and hope that helps :)
dml.jpgsmz.jpg

The first uses many room but no GUIs are really needed, the menu stays persistant through room changes (one room size)
The second uses one gameroom and needs GUIs to scroll with viewport there was no need to scale they just stay put and uses tiles
so you should use GUIs as your game requires, i only use them when they are required
There was another post, ill planned where he is trying to match a tileset to an 377x175 sprite 57x48...not good
Really hard to figure viewport tile stepping..you decide first what size tiles you want then make your sprite or tileset
Sorry, i think i went way off topic :)
 
Last edited:
L

lyra_bee

Guest
it really depends on what your game design is, scrolling background, static, tile based,
like say, i have an adventure game and each room has a background or is a minigame then i would use separate rooms, my menu system is kept off to the side of the room and scrolls in when activated
so i need the menu to be persistant between rooms and room size to be compatable with each other

but say, i have a side scroller, tile based, then i would use one room large tiled background and the guis to stay put in one place like a score
then i would have the viewport at the desired game window and scroll it with the player movements, and maybe some special rooms offscreen like caves to warp into
and if i want a bigger game then i would add another room with maybe a different tile set, now im in the jungle

you dont need a room for each object, maybe a death room or cut scenes or different levels or a pause room maybe init(which can be done during the splash screen so the user doesnt have any delay before playing)
i don't like load screens, i think they loading can be snuck in without any user delay,
the menu could be in an init room and if kept persistant it doesnt even have to be GUi, just use a hotkey and activate/deactivate the visibility or keep it offscreen and fly it in
i usually start my games with a splash screen, then to a new/continue and options menu room, (this menu is not persistant) only needed when starting or restarting so i wouldnt want it in my game room
that also initializes stuff
then to the game which has a persistant menu, like pause where i want it to stay in game,
you can have stuff off screen (outside the grid) and bring them in when needed like menus
most of the time i have seen this problem is when GUIs are drawn with exact co-ordinates with different room sizes
if you want a GUI object like a score, make a draw_gui event and just draw_self and if you leave it there it will scale between rooms there is no need to resize it even if room sizes are different
which i think is bad practice, gamemaker automates a lot of stuff, most of the scaling problems i see are from poor planning at the beginning
and people try to override gamemakers scaling
thats when scaling becomes the problem

if you just drop your gui object on the screen gamemaker will scale it between rooms, it you then use its x/y instead of 500/20 the x/y will be scaled to the room size, the the 500/20 will be placed at thoose co-ordinates
so if your roomsize is different it will not match, if that makes sense
if you plan a little in the beginning like tilesets you can avoid a lot of headaches later

ill try to post a few pics of what im talking about and hope that helps :)
Thank you :D Today hasn't worked out how I had planned with it, you know when you just have days where things that should work don't but your brain just hasn't got the room to sort it out? THAT

haha
 

Tyg

Member
I'm still trying to figure out the sequencer and timeline thing, and not sure about the particle system overhead
but any particle system is going to have that, the physics are great, ive made several mini games
Thats why i use gamemaker..lol, its not hard if you plan your game and let it do its thing :)
 
Last edited:
Top