enlarging a room while a game is running
#1
Posted 09 May 2011 - 09:08 AM
#2
Posted 09 May 2011 - 09:41 AM
Second, changing the size of an active room (or a persistent room that has already been active) on-the-fly can lead to some strange issues (according to the manual). So you should make all objects (not the room!) persistent, go to a temporary room, change the size of the original room using room_set_width() and room_set_height(), move back and restore the persistence state of all objects. This can all be done in a single script.
Note that, if you destroyed any objects that were originally in the room, they are created again. If this is an issue, you need to keep track of the objecs you destroy and destroy the same objects when you return to the room.
As you can see, it's quite a hassle and it should be avoided whenever possible.
#3
Posted 09 May 2011 - 09:45 AM
First I should say that if you can, just create a large map and make areas inaccessible. You shouldn't want to change the room size under normal circumstances.
Second, changing the size of an active room (or a persistent room that has already been active) on-the-fly can lead to some strange issues (according to the manual). So you should make all objects (not the room!) persistent, go to a temporary room, change the size of the original room using room_set_width() and room_set_height(), move back and restore the persistence state of all objects. This can all be done in a single script.
Note that, if you destroyed any objects that were originally in the room, they are created again. If this is an issue, you need to keep track of the objecs you destroy and destroy the same objects when you return to the room.
As you can see, it's quite a hassle and it should be avoided whenever possible.
well this is a very basic game, the room's height is 240 and the width is 640, all i want is in-game it increases to like 700 there 740 then 780 and so on width, by "purchasing" new blocks, its a 2d platform game, i might try using "room_set_width" i didnt try that...
#4
Posted 09 May 2011 - 09:51 AM
#5
Posted 09 May 2011 - 10:38 AM
room_set_width(myRoom, 700)
However I would advise against this because as Medusar said it can 'lead to unexpected errors'. What I would do is make the room a normal size and then just do stuff outside the room, there is nothing stopping you using parts outside the room and I myself have made a game which starts off in the room and then the rest of the game play is all outside the room.
#6
Posted 09 May 2011 - 02:06 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











