Ok, let's try this again
Hello everyone
I am working on a torn note puzzle for my game Incident At ROANOKE. I am trying to drag and drop pieces of torn paper into their proper place on a grid. I can get the puzzle piece to go in it's proper place but when I click on the puzzle piece it moves by itself to it's right position on the grid. I don't want it to do that. I want to be able to drag it and drop it in myself. I know where the problem is but can't for the life of me figure it out. If someone could take a look at the code I would be so grateful. I am just one puzzle and a few voices away from releasing this game. I really don't want to leave this puzzle out. The code is Delphi 7. It may look odd to everyone because it has been simplified for the Point and Click Development Kit game engine.
This is the function code
Code:setnum(MoveX;[mousex]-[xDifference]) setnum(MoveY;[mousey]-[yDifference]) moveobj(Note_[NoteNumber];[MoveX];[MoveY];0)
This is the code in the start up to tell P&C DK the positions of the puzzle pieces
This is the code for each puzzle pieceCode:realtime (true) loadroom (Room2) setnum (N1x ; 76) setnum (N2x ; 76) setnum (N3x ; 76) setnum (N4x ; 76) setnum (N5x ; 165) setnum (N6x ; 165) setnum (N7x ; 165) setnum (N8x ; 165) setnum (Note_1x ; 1) setnum (Note_1y ; 1) setnum (Note_2x ; 2) setnum (Note_2y ; 1) setnum (Note_3x ; 3) setnum (Note_3y ; 1) setnum (Note_4x ; 4) setnum (Note_4y ; 1) setnum (Note_5x ; 1) setnum (Note_5y ; 2) setnum (Note_6x ; 2) setnum (Note_6y ; 2) setnum (Note_7x ; 3) setnum (Note_7y ; 2) setnum (Note_8x ; 4) setnum (Note_8y ; 2)
The problem is in this part of the codeCode:on(click) { setnum (NoteNumber ; 1) setnum(xDifference;[mousex]-[objx:Note_[NoteNumber]]) setnum(yDifference;[mousey]-[objy:Note_[NoteNumber]]) function(papermove;infinit) } on (release) { if_yobj (Note_1 ; <202) setnum (ypos ; 1) if_yobj (Note_1 ; >201) setnum (ypos ; 1) setnum (xpos ; 0) setnum (xpos ; [n1x]) setnum (xpos ; [xpos]/159) if_num (xpos ; <1) setnum (xpos ; 1) if_num (xpos ; >1) setnum (xpos ; 1) setnum (ok ; 0) if_num (Note_4x ; [xpos]) if_num (Note_4y ; [ypos]) setnum (ok ; 99) if_num (Note_3x ; [xpos]) if_num (Note_3y ; [ypos]) setnum (ok ; 99) if_num (Note_2x ; [xpos]) if_num (Note_2y ; [ypos]) setnum (ok ; 99) if_num (ok ; 0) { setnum (Note_1x ; [xpos]) setnum (Note_1y ; [ypos]) } if_num (ok ; 99) playsound (wrong) if_num (Note_1y ; 1) setnum (ypos ; 76) if_num (Note_1x ; 1) setnum (xpos ; 76) setnum (n1x ; [Note_1x] * 159 + 4) moveobj (Note_[NoteNumber] ; [n1x] ; [ypos] ; 0) setnum (NoteNumber ; 0) playsound(button;100) stopfunction(papermove) }
Here is a before and after pictureCode:moveobj (Note_[NoteNumber] ; [n1x] ; [ypos] ; 0)
[IMG]By null[/IMG]
After assembly
[IMG]By null[/IMG]
I just can't figure it out. Thank you for taking a look.
StarLite
Last edited by WingedPanther; 03-03-2010 at 12:56 PM. Reason: Fix code tags
No luck guys? I'd really hate to leave this puzzle out of the game. I plan on writing a lot of games with this type of puzzle in it. It won't be a total loss I hope.![]()
Looks like a most wonderful game to play. Unfortunately, nobady here knows what could be the problem, becuse it's not wriiten in Pascal or Delphi. This forum happens to be the Pascal/Delphi forum.
Hi Firebird
The guy who created the game engine said it was created with Delphi and that the language is Delphi 7. I think he also said in one message that you could also use C+ language in the engine. Actually I think I might have a handle on what is wrong. It appears the problem is with the on(release), so I 'm going to give it a try today.
A lot of Delphi coders have said the same thing, that this isn't Delphi language, but it's a simplified version I guess. But on the specs for the engine it says components DelphiZip, whatever that means.
This one puzzle will take care of the game, all that's left is to finish up the male voices, have my friend test it and that's it, I hope. Thank you for taking a look, I really appreciate you trying.![]()
No, it's NOT Delphi. Delphi doesn't use braces ( the '{' and '}' symbols) at all.
The program you're using may have been coded in Delphi 7, but that doesn't mean YOUR program is also Delphi 7. It's not.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks