When Carl is at x1 y1 Carl does not image_blend c_red please help. Thanks :)

Carl Step Event
Code:
Information about object: Carl

Sprite: Carl_Spr
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

 Step Event:
execute code:

/*
I Jason am using for what I had for a super long time
Game Maker 7.0 Pro Edition
*/
if (!keyboard_check(vk_control))
{
  if (keyboard_check(vk_up))
  {
    y -= 1;
  }
  if (keyboard_check(vk_right))
  {
    x += 1;
  }
  if (keyboard_check(vk_left))
  {
    x -= 1;
  }
  if (keyboard_check(vk_down))
  {
    y += 1;
  }
}
else if (keyboard_check(vk_control))
{
  if (keyboard_check_pressed(vk_down))
  {
    y += 1;
  }
  if (keyboard_check_pressed(vk_left))
  {
    x -= 1;
  }
  if (keyboard_check_pressed(vk_right))
  {
    x += 1;
  }
  if (keyboard_check_pressed(vk_up))
  {
    y -= 1;
  }
}
if (keyboard_check_pressed(ord("J")))
{
  x = xstart;
  y = ystart;
}
if (instance_exists(Wall))
{
  if (position_meeting(1,1,Wall))
  {
    image_blend = c_red;
  }
}


Wall Step Event
Code:
Information about object: Wall

Sprite: Wall_Spr
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

 Step Event:
execute code:

/*
I Jason am using for what I had for a super long time
Game Maker 7.0 Pro Edition
*/
if (x != 1 && y != 1)
{
  x = 1;
  y = 1;
}


I Jason want when Carl collides with Wall at x1 y1 to image_blend c_red please.
 

Nidoking

Member
@Nidoking position_meeting(1,1,Wall) I think if colliding at Wall's x1 y1 something happens.
This has nothing to do with a Wall or an x1 y1 (whatever that is). This returns true if there is an instance of Wall at the position 1,1 in the current room. Now, if there is at least one Wall, the step event you posted will place every Wall in the room at 1,1 every step. That's ridiculous to begin with. The question then becomes whether the origin pixel for the Wall's sprite is inside its bounding box. It probably is, but you've given no information to make that clear. If you're using precise collisions, then it might not be. This also has absolutely nothing whatsoever to do with your Carl object or any aspect of it, including the location of any instances of Carl in the room. You're not using the position of the Carl for this check. You're using 1,1. You're not using the Carl's sprite in the check. You're checking a single point. I think doing a tutorial would do you a world of good, because it doesn't seem like you know very much about Game Maker, and me solving this problem for you isn't going to change that.
 

FrostyCat

Member
@Nidoking position_meeting(1,1,Wall) I think if colliding at Wall's x1 y1 something happens.
It does not mean what you think it means.

This article was available a decade ago and so was the manual entry for it. Read them, they still apply. In your situation, place_meeting(x, y, Wall) clearly makes more sense than position_meeting(1, 1, Wall), and you should add an else catching the case where you move out of contact.

On top of that, what the hell were you thinking when you put this in the Wall's step event?
GML:
if (x != 1 && y != 1)
{
  x = 1;
  y = 1;
}
This would pin every instance of the Wall to (1, 1), unless either x or y started as 1. This cannot possibly be intended behaviour, and should have been noticeably wrong on first run.

It's kind of pathetic to still see your writing, code and general way of thinking virtually indistinguishable from ProdigyGM and Tailware Times, even after all the time that has passed since then.
 
Last edited:
Top