• 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!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows is this a bug of gamemaker 2.0?

tomlee2020

Member
i create OBJECT:Obj_fen.
and i Define variables fen.
and i add
Draw event , I want to show fen value by this event.
in other OBJECT:Oby_baozha
I add step event .i want to see sprites image_number.
so i use two way.
one way is use variables fen.
the other way is use show_debug_message.
I don't understand why I got two different numbers
first way i get value always be 0
The second way i get right value 14.
1.jpg
2.jpg
3.jpg
4.jpg
 
No, it's not a bug. obj_fen does not have a sprite, therefore, it has 0 sub-images. The with (obj_fen) { makes the code in the brackets run as though it were running in obj_fen itself, so it pulls the image_number from that object, rather than obj_baozha (the object that has a sprite). If you want obj_fen to display the number of sub-images that obj_baozha has, you can do it multiple ways, just not the way you are doing it. Here's one way:
Code:
with (obj_fen) {
  fen = string(other.image_number);
}
 

tomlee2020

Member
No, it's not a bug. obj_fen does not have a sprite, therefore, it has 0 sub-images. The with (obj_fen) { makes the code in the brackets run as though it were running in obj_fen itself, so it pulls the image_number from that object, rather than obj_baozha (the object that has a sprite). If you want obj_fen to display the number of sub-images that obj_baozha has, you can do it multiple ways, just not the way you are doing it. Here's one way:
Code:
with (obj_fen) {
  fen = string(other.image_number);
}
THANK YOU
 
Top