Legacy GM Creating a scale tool

Hello everyone!
I've tried so many things to do this and I just don't know how to do it, I'd prefer it done with image_xscale and image_yscale but it's fine if it can't.
I am currently working on a map editor for my game and I want to make a scale tool that when you click an object two circles will appear one to the left and one under the object.
When you click the one to the left and move it, it will change the xscale of the object and when you click the bottom one it will change the yscale. I have no clue how to do this all the methods I've tried failed vary badly :mad:

if you have any sort of idea to do this then please reply. thanks! :)
 
T

TesloStep

Guest
two circles - two new objects, every keept link to their target object.
mouse draging - well, maybe set x and y to mouse when clicked.
upon release calculate difference in position and modify scale of target obj.

nothing difficult yet
 
two circles - two new objects, every keept link to their target object.
mouse draging - well, maybe set x and y to mouse when clicked.
upon release calculate difference in position and modify scale of target obj.

nothing difficult yet
I knew that's what I needed to do but how? (the third part about calculating not the rest :) )
 
two circles - two new objects, every keept link to their target object.
mouse draging - well, maybe set x and y to mouse when clicked.
upon release calculate difference in position and modify scale of target obj.

nothing difficult yet
do you know how to do the third part? :)
 

TheouAegis

Member
Store the object's bbox_left and bbox_bottom in variables. Subtract 8 or whatever from the bbox_left variable. Add 8 or whatever to the bbox_bottom variable. The 8 is how far from the edge of the object the circles will be. To calculate the xscale and yscale, you can do

if global.resizing == 1
image_xscale = (mouse_x - leftstart) / sprite_width;
else
if global.resizing == 2
image_yscale = (mouse_y - bottomstart) / sprite_height;
 
Top