Closed Thread
Results 1 to 5 of 5

Thread: Torn Note Puzzle

  1. #1
    Join Date
    Feb 2010
    Location
    Canada
    Posts
    25
    Rep Power
    0

    Torn Note Puzzle

    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

    Code:
    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)
    This is the code for each puzzle piece

    Code:
    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)
       }
    The problem is in this part of the code

    Code:
    moveobj (Note_[NoteNumber] ; [n1x] ; [ypos] ; 0)
    Here is a before and after picture

    [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

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Feb 2010
    Location
    Canada
    Posts
    25
    Rep Power
    0

    Re: Torn Note Puzzle

    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.

  4. #3
    Firebird_38 is offline Programmer
    Join Date
    Aug 2008
    Posts
    126
    Rep Power
    0

    Re: Torn Note Puzzle

    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.

  5. #4
    Join Date
    Feb 2010
    Location
    Canada
    Posts
    25
    Rep Power
    0

    Re: Torn Note Puzzle

    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.

  6. #5
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Torn Note Puzzle

    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.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. problem with 15 puzzle
    By Thegame16 in forum JavaScript and CSS
    Replies: 0
    Last Post: 04-04-2011, 05:22 PM
  2. Cryptogram Puzzle help
    By Renee55 in forum HTML Programming
    Replies: 1
    Last Post: 08-28-2010, 03:29 PM
  3. A note to the admin
    By Ronin in forum The Lounge
    Replies: 4
    Last Post: 05-19-2006, 02:45 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts