Jump to content

Concentration Game


CangoJoe
 Share

Go to solution Solved by AggrorJorn,

Recommended Posts

Hey all,

I thought I'd try my hand out at another Leadwerks Tournament game. I wanted to make a Concentration type game where you select 2 crates and compare them.

concentrationcrates.thumb.jpg.ae7bbbe59c04fd25f537387a7b9e6da6.jpg

 

 

 

 

 

 

I used a modified version of the Spectator.lua script where I locked the camera in place, disabled movement and enabled the onscreen mouse.

The player will click Mouse Button 1 to select 2 crates and then the crates are compared. The problem I'm having is detecting where the cursor (MousePosition) is in relation to the world (what its hovering over) in order to determine which crate was clicked. Is there a way to convert mouse position to a world position?

I was thinking I could do something as seen below in order to Pick() objects below the cursor/MousePosition (pseudo code):

If MouseDown(1)

     If world:Pick(MousePositionVector, WorldPositionVector, pickinfo, 0, true, 1) then

         IsValidCrate() --Determine if a crate was clicked

         CompareCrate() --Compare crate

         DoStuff() --Despawn crates, tally score, fanfare, etc..

      End

End

Perhaps there's a better way?

Thanks in advance for any input!

-can

Link to comment
Share on other sites

  • Solution

Pseudo approach

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...