S
steph
Guest
Hi, I'm completely new to programming and decided to follow FriendlyCosmonaut's Farming RPG tutorial series on youtube. I'm trying to set up the room transition area but my character just walks right through it with no reaction.
This is the code I put under the player's Step action for the collision and transition:
I made obj_transition and under the Create action put this:
And at the door where I put up the transition area to enter the building (room2), under Creation Code I put this:
Any help appreciated!
This is the code I put under the player's Step action for the collision and transition:
Code:
//------ collision
// horizotal
if(moveX != 0){
if(place_meeting(x+moveX, y, obj_collision)){
repeat(abs(moveX)){
if(!place_meeting(x+sign(moveX), y, obj_collision)){
x += sign(moveX);
} else {break;}
}
moveX = 0
}
}
// vertical
if(moveY !=0){
if(place_meeting(x, y+moveY, obj_collision)){
repeat(abs(moveY)){
if(!place_meeting(x, y+sign(moveY), obj_collision)){ y += sign(moveY); }
else {break;}
}
moveY = 0
}
}
// transition
var inst = instance_place(x,y,obj_transition);
if(inst = !noone) {
room_goto(inst.targetRoom);
}
//------- apply movement
x += moveX;
y += moveY;
I made obj_transition and under the Create action put this:
Code:
targetRoom = -1;
Code:
targetRoom = rm_farm_house;
Any help appreciated!