increase scene size vs drag and drop issue
chicop
Member Posts: 263
Hi there
so, all the ruckus aside i'm still trying to make a game and have a question...
I have a drag and drop inventory system that snaps to grid which works and all is well. However ive decided to increase the size of the game field/scene size from 320W X 480H.. to 320 X 720
when i drop the items in the say new added part of the screen they snap to the older play field being 480H.. so basically anything i drop into the area between 480 X 720 snaps to 480..
how can i best adjust this so my snap to grid works through out the entire scene/game field?
cheers
so, all the ruckus aside i'm still trying to make a game and have a question...
I have a drag and drop inventory system that snaps to grid which works and all is well. However ive decided to increase the size of the game field/scene size from 320W X 480H.. to 320 X 720
when i drop the items in the say new added part of the screen they snap to the older play field being 480H.. so basically anything i drop into the area between 480 X 720 snaps to 480..
how can i best adjust this so my snap to grid works through out the entire scene/game field?
cheers
Comments
The mouse always uses the 320x480 workspace. If your Scene is larger than that, and you need to interact with the screen, you need to add in the Camera Origin coordinates.
The Camera Origin is the lower left corner at all times.
Only an Instance can access the camera data, not an actor in the Library, so you will need to add a camera controller actor to your Scene.
Let me know if that doesn't make sense or you need help with it.
then i create a camera controller and ad constrain attribute game.cameraX to scene.camera.originX do the same for Y
now this is the part i get lost..
when touch is pressed
constrain game.movex to game.Touches.Touch 1.X + game.CameraX
constrain game.movey to game.Touches.Touch 1.y + game.CameraY
this is not what i have at al in my actors that i drag out of a menu into the game field..
i have a when dragging is true snap to grid rule which has a constrain attribute in it as follows..
self.position.x to (ceil((floor((game.mouse.position.x / game.cellwidth )*2))/2))* game.cellwidth (not my code i got this out of the snap to grid tutorial) and then a otherwise constrain attribute self.position.x to game.mouse.position.x (also for y)
i take these two tell it where and when to snap to grid etc however i hust cant figure out where to place it all.. perhaps my code is over complicated and im just getting lost
thanks
this also helped but i guess the boolean thing was no good hehe
http://gamesalad.com/wiki/how_tos:gsc_drag_and_drop_movement
only thing is now it overrides my snap to grid... which although not major i sort of like the feel it adds to dropping stuff from the inventory to the play field...
il keep trying, but if some one knows how i can have both that be awesome
thanks again!