Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Need some guidance in stretching or shrinking sprites at their edges via mouse drag like a editor would do.

Author
Message
Dark Raven
8
Years of Service
User Offline
Joined: 27th Jul 2014
Location: United States
Posted: 15th May 2020 07:08
I need some guidance as I seem to be getting no where with figuring out how to this. What I'm trying to figure out how to accomplish is some what like what an editor would do. For instance I've got a sprite on the screen. When mouse is on the left side of the sprite and the button state is pressed that the sprite is either stretch or shrunk based on the direction of the mouse and based on the edge of the sprite.

I was thinking of some how using other sprites as sizers but then my mind when blank on how to actually to do this.

So if any one can help it would be greatly appreciated.
fubarpk
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 15th May 2020 08:33 Edited at: 15th May 2020 08:57
integer GetSpriteHit(GetPointerX ( ), GetPointerY ( ) ) will return the id of the sprite you have clicked with mouse
SetSpriteSize ( iSpriteIndex, width, height ) will allow you to change the width and height if sprite

the below should give you a starter click the white square in top left corner and hold down mouse moving to right or downwards


You will need to do some math with the actual sprite x location and the position of the mouse to resize a sprite
not all the way to the left and ofcourse y needs the same math so the sprites can be positioned anywhere but
that should give you a starter

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Dark Raven
8
Years of Service
User Offline
Joined: 27th Jul 2014
Location: United States
Posted: 16th May 2020 04:36
I want to thank you for the help. I'm a visual person so the math I was trying to figure out was not working one bit but with your code I could visually see and actually start thinking of the formula needed for what I'm trying to do.

Again appreciate the help on getting a starting place.
fubarpk
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 16th May 2020 06:14
your welcome
most problems are too hard to see for most people that's why you break them down into
much smaller tasks the whole idea of pseudocode etc. but glad I helped

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk

Login to post a reply

Server time is: 2022-11-30 14:52:55
Your offset time is: 2022-11-30 14:52:55