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.

2D All the way! / Drag and drop problem

Author
Message
ssj3_shadow
23
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 10th May 2004 05:26 Edited at: 10th May 2004 11:32
The following code is used to drag and drop an inventory item (sprite) arround the screen, the mouse is sprite #1 and the WpnSpriteNum is the inventory item currently selected. The code works but if the mouse moves too fast then the item is dropped
is there any way i can update the items position faster?, or is there a better wat to acheive what i want?


w00t -what does it mean?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th May 2004 11:21
What do you mean the mouse moves too fast when the item is dropped??? Do you want to speed the mouse up, or slow it down??? It sounds like you are saying that the items are too slow, and the mouse is too fast, which sounds contradictory to me.

ssj3_shadow
23
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 10th May 2004 11:38
Not wanting to be rude but next time read what i have writtn before incorrectly quoteing me
Quote: "The code works but if the mouse moves too fast then the item is dropped
"

is what i said, not
Quote: "What do you mean the mouse moves too fast when the item is dropped??? "


but mebe i can explain what i mean a bit better to halt any fucture miss quotes.

i click on a sprite and move it arround with the mouse, if "I" move the mouse too fast (jerk it) then the code no longer references the sprite collision. this (as far as i can see) is because the mouse moves faster than the sprite number,x,y,image command dose not update as fast as the mouse can move.

i would like any suggestions as to how i can fix this problem, or any alternate ways of doing what i posted

w00t -what does it mean?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th May 2004 13:20
Well, once you have picked an object up, you don't need to check for sprite collision anymore. So just ignore the collision, and move the object around with the Mousex() Mousey().

ssj3_shadow
23
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 10th May 2004 15:50
Right nice idea, how could i edit my code to stop the test for collision once i've selected an item?

w00t -what does it mean?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th May 2004 17:11 Edited at: 10th May 2004 18:30
I think this will work, it depends on what your sprite numbers mean. If it doesn't work, try reversing pickup = 1 to 0, and pickup = 0 to 1.



Emperor Baal
22
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 10th May 2004 18:14 Edited at: 10th May 2004 18:14
Why not this?



Quote: "
UPDATED

Amd 2800+ 1024mb pc3200 A7N8X - Deluxe Ati Radeon 9800PRO 256mb
"
Prep
22
Years of Service
User Offline
Joined: 17th Nov 2003
Location:
Posted: 10th May 2004 22:03
Personnally I find repeat untills the best way to do drag and drop, I don't use collision either. Heres a sample of the code I used for moving parts of my GUI around in an top down rpg i'm writing. Note though in the code that the object only has a certain area that allows it to be moveable.



Might be worth having a look at doing this way, in my case I wanted it to suspend my main loop while drag and dropping so this way seemed perfect.

To be no more, sad cure.
ssj3_shadow
23
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 11th May 2004 06:46
Thanks for all the suggestions, the solution to my question was provided by Prep The trick was to suspend the main do loop and repear until the sprite movement i' post my function below if anyone would like to see a working inventory ala Baldur's Gate etc.
once again thanks

w00t -what does it mean?

Login to post a reply

Server time is: 2026-06-09 15:43:13
Your offset time is: 2026-06-09 15:43:13