generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Dragging Slots

Previous Thread :: Next Thread 
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
15 Dec 2014 04:19 PM
So I've made a basic inventory system set up, and I have everything I would need as of now done, except for one important feature. I need to find a way to drag items in one slow into a different slot.

Any ideas on how to do this? I know that I would need .MouseButton1Down events and such and the draggable property set to true, but how would I actually go about doing this?

If you would like to see the inventory; http://www.roblox.com/Inventory-System-place?id=186778639
Report Abuse
iwishforpie1 is not online. iwishforpie1
Joined: 20 Mar 2011
Total Posts: 1423
15 Dec 2014 04:24 PM
http://wiki.roblox.com/index.php?title=API:Class/Mouse
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
15 Dec 2014 04:26 PM
No, that wouldnt help, and I already know what the mouse is.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
15 Dec 2014 04:29 PM
Mouse down >> move to mouse position every frame
Mouse up >> Snap to grid position (math.floor(Pos/scale+0.5)*scale), check a table for items in grid position, handle event.
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
15 Dec 2014 04:35 PM
How would I snap it if every square is 75x75 pixels and has a spacing of 7 pixels?
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
15 Dec 2014 04:39 PM
Scale is 82 then isn't it. Just snap it to (math.floor((Pos/82)+0.5)*82)-7 (or -3.5 or something)
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
15 Dec 2014 04:39 PM
Im using offset, not scale
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
15 Dec 2014 04:44 PM
I didn't mean that kind of scale...

Also I was silly. It's actually

local grid = math.floor((Pos/82)+0.5)
return (grid*82)-((grid-1)*7)-3.5
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
15 Dec 2014 04:52 PM
tysm
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
15 Dec 2014 04:54 PM
Eh whatever I'm tired I can't validate it in my head for some reason it's one of those two or some variation of
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
15 Dec 2014 04:55 PM
Ill try out both
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
15 Dec 2014 04:59 PM
Remember you'll have to do it for X and Y offsets individually
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image