I think.....I might find it less confusing if sprite_index, sprite_width and _height were read-only specific to the sprite object
First of all: Sprite object? There are sprites, there are objects and there are instances, and neither of them are synonymous. Which of them did you refer to here? (According to the supplemental context info that follows in your post, I assume you meant sprite.)
sprite_width and
sprite_height are read-only.
sprite_index can not be read-only as it is intended for the developer to be able to change an instance's default sprite at run time.
and a set of variables called image, image_width and _height were instance-specific. Then I'd understand that sprite_index, sprite_width, and sprite_height and any other sprite_whatever referred to the raw, unaltered sprite object shared across all instances. Image, Image_width, _height, _xscale, _yscale, would all be instance-only variables.
I believe what you are looking for already exists in the form of
sprite_get_width and
sprite_get_height. These get the width and height of a specified sprite and height at its original size and are mentioned in the manual entries of
sprite_width and
sprite_height for clarity.
I see what you mean, though - the naming of some of these might lead you to believe that they refer to sprites in general, not specifically the calling instance's assigned sprite. There is indeed no clear-cut distinction between those two in the current variable and function naming scheme.
Some things to note. You may already be familiar with some of these - if so, imagine I'm including them for the sake of completeness.
-
sprite_index itself is not and does not store a sprite, it stored a number. Said number is the ID of a sprite.
-
draw_sprite* functions instruct the engine to draw a sprite (based on its ID) to be drawn with specific parameters. This is purely visual and has no effect on the bounding box.
-
image_*scale directly affect the bounding box and are a multiplier to the original size. They only affect drawing if there is either no Draw event (so the default Draw code will be used) or they are directly used in a Draw event's code.
- Once drawn to the screen, drawn sprites can no longer be interacted with and have no properties. Drawing a scaled version of a sprite does not create a copy of said sprite, and the scaled version is not tangible - it exists only as pixels on a surface.
Since anything that happens in the Draw event does not affect the bounding box and therefore wouldn't be visible otherwise, I like to put this piece of code at the end of an object's drawing code to see what my bounding boxes actually look like:
Code:
draw_set_color(c_red);
draw_rectangle(bbox_left, bbox_top, bbox_right, bbox_bottom, true);