When does visibility affect collisions?

Focksbot

Member
Working with hitboxes, I thought I had everything finally figured out, until I turned the hitbox sprite visibility to 'off' in order to preview the game without visible hitboxes.

Suddenly my player object started reacting as if the hitbox were colliding with another hitbox. This is the code:

Code:
       if (image_index >= 2) && (image_index <= 9)
        and hit == 0
        {
            var attacker_id = id       
            with (instance_create(x,y,obj_hitbox))
            {
                image_xscale = other.image_xscale;
                hitbox_id = other.id;
                
                with(obj_hitbox) {

                    if place_meeting(x,y,other) {
                    
                        with(obj_player) {
                        
                            if hit == 0 {
                        
                                y -= 5
                                bounce = 1;
                                hit = 1;
                            
                            }
                        }
                        
                    }
Basically the 'bounce' variable is being activated whenever the instance of the hitbox is created, but *only* if 'visible' is unchecked. Once I make the hitbox visible again, it behaves properly, only bouncing the player when two separate hitboxes collide.

Can anyone explain what's going on here?
 

The-any-Key

Member
When you set visible=false. The draw events wont run in the instance. Make sure you don't have any code in the draw events.
 
Top