• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows Room transition help.

S

saioren

Guest
So everything mostly works in this game i'm making. Im just following the friendlycosmonaut's farming game tutorial but I have this issue.

When I switch room with the transition object, which works perfect, I can't move after the transition.
My sprite animation works when I press up down left and right, he just doesn't actually move. Same thing with my other transition into my house.

Character walking into transition coding here: (located in obj_player)

var inst = instance_place(x,y, obj_transition);
if(inst != noone and facing == inst.playerFacingBefore){
with(game){
if(!doTransition){
spawnRoom= inst.targetRoom
spawnX = inst.targetX;
spawnY = inst.targetY;
spawnPlayerFacing = inst.playerFacingAfter;
doTransition = true;
}
}
}

Transition text: (located in obj_transition/create)

targetRoom = -1;

targetX = 0;
targetY = 0;
playerFacingBefore = -1;
playerFacingAfter = -1;

Lots of text for how I walk: (obj_player/step)

input_left = keyboard_check(vk_left);
input_right = keyboard_check(vk_right);
input_up = keyboard_check(vk_up);
input_down = keyboard_check(vk_down);
input_walk = keyboard_check(vk_control);
input_run = keyboard_check(vk_shift);

//alter speed
if(input_walk or input_run) {
spd = abs((input_walk*w_spd) - (input_run*r_spd));
} else {
spd = n_spd;
}

//---------reset move variables
moveX = 0;
moveY = 0;

//---------intended movement
moveX = (input_right - input_left) * spd;
if(moveX == 0){ moveY = (input_down - input_up) * spd; }


I'm not sure if this code even includes the problem but, what do you think?
 

SoapSud39

Member
Is there some sort of restriction on moving? I haven't done this tutorial, but is there something in the player code like
"if !game.doTransition {
//movement code​
}"
If there is, then check to make sure you're making doTransition false at the beginning of the level.
If not, you may have to post more code, because I don't think the problem is in what you have here.

hope this helps
 
S

saioren

Guest
Hey, I found this little chunk of code with (!doTransition) in it, in the step event for my obj_player.

var inst = instance_place(x,y, obj_transition);
if(inst != noone and facing == inst.playerFacingBefore){
with(game){
if(!doTransition){
spawnRoom= inst.targetRoom
spawnX = inst.targetX;
spawnY = inst.targetY;
spawnPlayerFacing = inst.playerFacingAfter;
doTransition = true;
}
}
}

This may be the problem ?
 

SoapSud39

Member
Okay, I took a look through the video and discovered that Friendly Cosmonaut didn't actually have a restriction on movement as I had supposed.

so this:
Hey, I found this little chunk of code with (!doTransition) in it, in the step event for my obj_player.

...

This may be the problem ?
isn't the problem, or at least not in and of itself, because it looks like you've followed the tutorial exactly here, so I can't really help you with what we have on this thread currently. If you wouldn't mind, attach your player movement code (either use the code feature in the formatting or send a screenshot) and I can take a look to see if I can find any mistakes you're making.

(keep in mind that since I haven't actually gone through the tutorial series myself I can't guarantee anything, but I'll try if you send your code)
 
S

saioren

Guest
So heres whats in obj_player but there is also a "game" object that has some weird things in it too.
 

Attachments

S

saioren

Guest
Game obj followup.

It isnt the end of the world if it can't be fixed. My character never moved in a new room one time thru the tutorial, and hers did first try so it's weird.

Also PS she changed some movement collision code halfway through the series so thats why collisionV and collisionH arent in that video.
Referencing obj players movement
 

Attachments

SoapSud39

Member
Okay, I glanced through the code and didn't find anything fatally wrong at first glance. But do this before I attempt to try out the code or something:

Check that your spawn x and y don't coincide with a collision object. The way your collision code works right now, if you're more than 3ish pixels into the collision object your player just won't move at all. Easy way to check is to just turn on your debug variable (the 0 keybind) and check if the yellow rectangles overlap. Check this right after you transition, because right now I'm hoping the problem's as simple as bad spawn coordinates.
 
S

saioren

Guest
Hey! I discovered the issue, and you hit the nail right on the head. I'm getting room 1 object square indicators in room 2.

I have a small pond at the left most of my room 1, and when I enter room 2, i'm in the pond. There's no pond, but the square is there. Along with squares to show all the other objects in the room.

So heres my question;

how do I delete an object that isnt in the room ? Are the two rooms overlapping? Thank you again.

Photo 1 is room 1
Photo 2 is room 2.
 

Attachments

SoapSud39

Member
a few possibilities:
1. the objects are in the room (probably not, but make sure there's nothing under the tile layer in room 2)
2. your collision object is marked as persistent (though I don't know if that would cause this effect), in which case untick that
3. it's something about the room being inherited or duplicated (I also am not sure if room inheritance would cause this though)
4. it's a GMS2.3 bug, in which case file a report, and I can't really help you further
5. it's not a bug, but something else, in which case I also don't really know what to do

assuming everything else is fine, I've never really run into a problem like this, so this is a first for me too
hope this helps
 
S

saioren

Guest
I cant believe it was such a simple issue. Persistent collision object. I always over think the issue thats crazy. You've saved me
 
Top