Posted By
|
Message
|
Dark Link
Registered 06/02/2009
Points 90
|
25th April, 2009 at 03:00:23 -
how to do it?
like when you click the edge of a picture to resize
Edited by Dark Link
http://www.create-games.com/project.asp?view=main&id=1554
Super Mario Conquest!
|
Chloe Sagal under the influence of FUN
Registered 19/02/2009
Points 607
|
25th April, 2009 at 07:38:47 -
logically to do something like this it helps to plan out each thing that you might need for it to work
1 define the area that you can click
2 when the click button is held in that area, set the item to the shape of the opposite corner by the position of the mouse
3 set the new size of the picture base on where the mouse button was let go
defining the area can be done a number of ways, get creative and try what works for you. the easiest way would to problably have a separate object to represent the area that you want to resize snapped to the box (by doing an "always" set resize box to object). there might also need to be an object that is set to the x and y of the mouse (set the objects x to XMouse and the y to YMouse).
next you have to define a flag on either the object you wish to resize or the resize box. then if the user is not holding the mouse button, set the flag off. when the user clicks, check to see if the mouse object is overlapping the resize box then set the flag on. then when the user is holding the button down and the flag is on, then you do your calculations for the re-size of the object (i cant really tell you what you need, but someone might be able to give you a clue).
but outside of how the object actually resizes, that is problably a decent start. there are problably other ways to set up the resize box as well (with out using a separate object for instance, there should be a 'mouse object' x is greater that right edge of resize box - 10[or whatever], then less than right edge of box with a y condition thrown in if you wish, and the opposite of the other side and y exchanged for x for the top and bottom, most likely the more data conserving method.)
play along with the scale commands and see what works (i havent really got them to work to my liking, but i havent had much need to mess with them other than particle effects tho)
but good luck, hope this helps.
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal
|
Sketchy Cornwall UK
Registered 06/11/2004
Points 1971
|
25th April, 2009 at 13:56:11 -
Here's a pretty basic example:
http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/Resize.zip
n/a
|
|
|