SOLVED..After Dragging Object new object appears once area is clicked on

Started by barefoot, Sun 28/03/2010 10:43:14

Previous topic - Next topic

barefoot

Hi

I have the following Drag Object code which works fine. What I am trying to do is set a condition so that when it is clicked in a certain area or on another Object another Object becomes visible, as if you have placed the dragged object there... The dragged object obviously dissapears once the new object is visible.. also the hand curser should return to a hand once that object piece is in place correctly..

I don't want objects added to inventory...

Possibly check for x y position ???

Similar sort of thing to a jigsaw puzzle


Code: ags

function noloopcheck odrag_Interact(){
  while(mouse.IsButtonDown(eMouseLeft)){
    odrag.X = mouse.x;
    odrag.Y = mouse.y;
      Wait(1);
         }
}



What would be the simplest way..

Thanks for any help on this..

barefoot




I May Not Be Perfect but I Have A Big Heart ..

Wonkyth

You might have to explain what you want more clearly, I can't understand if there is more you want you code to do, or if something you don't want to happen is happening.
"But with a ninja on your face, you live longer!"

barefoot

Quote from: wonkyth on Sun 28/03/2010 12:13:11
You might have to explain what you want more clearly, I can't understand if there is more you want you code to do, or if something you don't want to happen is happening.

I thought it was pretty explanatory when i wrote it...

anyhow, this is a summery:

Quote
User has to drag an object, which is a puzzle key, to a specific location,when the location (puzzle hole) is reached the objects puzzle key and puzzle hole dissapears and a new object appears which is of the puzzle key in the puzzle hole.. I would also like the Hand Icon to reappear as usual after Puzzle Key dissapears.

Its proberbly a case of Object collides with Object to cause other conditions to happen?

There are 6 puzzle keys on display and 1 puzzle hole on display... only the correct puzzle key fits, if you try and use another puzzle key then you are forfeited in some way...

There are clues to the correct Key along the journey.

All puzzle keys are draggable.

I could of course obtain a Puzzle Key and add it to inventory and use it from there but i want to use the drag method as i have other uses for draggable options throughout game.

Hope this is clearer..

Thanks
barefoot







I May Not Be Perfect but I Have A Big Heart ..

barefoot

Hi

This is close but the puzzle key object jumps (osaucer1) and the change's happen before they are supposed to. ALSO object 2 does not dissapear but Object 1 dissapears and object 3 appears..

Code: ags

function noloopcheck osaucer1_Interact(){
  while(mouse.IsButtonDown(eMouseLeft)){
    osaucer1.X = mouse.x;
    osaucer1.Y = mouse.y;
    Wait(1);
  }
if (object[1].IsCollidingWithObject(object[2])) 

   
  object[2].Visible = false;
    object[1].Visible = false;
      object[3].Visible = true;

  Display("You have used the correct Puzzle Key!");
  }



Can someone check this script  for errors or possibly a work-around.

UPDATE.. Works if osaucer1 clicks directly onto object 2. If I release mouse elsewhere or click it elsewhere the problems stated previously happens...

barefoot

I May Not Be Perfect but I Have A Big Heart ..

Dualnames

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

barefoot

Hi

UPDATE= SOLVED

Made a View of Original Hand Cursor and Changed line to:

Code: ags

mouse.ChangeModeView(eModeInteract, 26 );



I changed my interaction drag option ideas to the code below but when changing Hand Cursor back to normal after event I get an 'animating' Cursor and it does not change to Hand.. The rest of it works fine.

Obviously I want Hand Cursor which is non animating as usual.

Code: ags

function osaucer1_Interact()
{
mouse.ChangeModeView(eModeInteract, 14);
object[1].Visible = false;
}

function osaucer2_Interact()
{
 if (!osaucer1.Visible) {
 Display("This should be the right Key");
 object[2].Visible = false;
 object[3].Visible = true;
 mouse.ChangeModeGraphic(eModeInteract, 2057);
 }
}



barefoot

I May Not Be Perfect but I Have A Big Heart ..

SMF spam blocked by CleanTalk