F
FlamingYeti
Guest
Okay, basic concept. Below is my Player's collision code. To summarise, it checks if it will hit a wall next frame, and if it will, then vspeed/hspeed is set to 0. This works fine with 128x128 wall tiles, but with a door that changes sub-image and rotation, that's a little trickier.
Just to point out super quick, this might be a super-easy fix. I'm no GM Genius, yet, so it could be a setting I've missed.
My problem is that when checking if there's an object there [place_meeting(x + hspeed,y,oSolid)], detecting blank space where the door has parted down the middle counts according to place_meeting, so I can't walk through the door. Pictures below will explain better.
To summarise, how can I make place_meeting not pick up blank space on a sprite as being a collision?
Code:
AutoRotate (Automatically rotates the door to it's correct orientation in Draw)
Door Draw Code
Player Collision Code
I know I really poorly explained this, so if you need me to clarify, or provide any more details, I gladly will.
P.S. The problem has evolved, and hasn't always been like this. It started off as the Player would always collide with where the Door is in the raw Sprite, but I changed it so the door changes it's direction to fit it's image_angle.
Just to point out super quick, this might be a super-easy fix. I'm no GM Genius, yet, so it could be a setting I've missed.
My problem is that when checking if there's an object there [place_meeting(x + hspeed,y,oSolid)], detecting blank space where the door has parted down the middle counts according to place_meeting, so I can't walk through the door. Pictures below will explain better.
To summarise, how can I make place_meeting not pick up blank space on a sprite as being a collision?
Code:
AutoRotate (Automatically rotates the door to it's correct orientation in Draw)
Code:
if place_meeting(x,y - 128,oSolid) and place_meeting(x,y + 128,oSolid) {
if x > oCentre.x { //oCentre is an object in the middle of the level.
Axis = 90
} else {
Axis = 270
}
} else if place_meeting(x - 128,y,oSolid) and place_meeting(x + 128,y,oSolid) {
if y > oCentre.y {
Axis = 0
} else {
Axis = 180
}
}
Code:
AutoRotate()
direction = Axis
image_angle = Axis
if distance_to_object(oPlayer) < 50 {
if CurrentSub < 11 {
CurrentSub += 1
}
} else {
if CurrentSub > 0 {
CurrentSub -= 1
}
}
draw_sprite_ext(sAutoDoor,CurrentSub,x,y,image_xscale,image_yscale,Axis,image_blend,image_alpha)
Code:
if place_meeting(x + hspeed,y,oSolid) {
hspeed = 0
}
if place_meeting(x,y + vspeed,oSolid) {
vspeed = 0
}
P.S. The problem has evolved, and hasn't always been like this. It started off as the Player would always collide with where the Door is in the raw Sprite, but I changed it so the door changes it's direction to fit it's image_angle.