Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Point&Click  (Read 3575 times)
Master-Andy
Community Member
*
Posts: 5


« on: May 16, 2004, 12:17:16 PM »

Hi!

I will programme a Point&Click Adventure! Can you help me how to make a point&click in a 3D room?
Thx!

Ciao Andy!
Logged
houde
Community Member
*
Posts: 482


WWW
« Reply #1 on: May 17, 2004, 02:39:54 PM »

newborn would reply :

"someone please give me a shotgun"

you can program wathever you want if you want and if you're enough good to do it... but do not ask people to explain you how to do your program.
also, if you want to ask a question, ask a more precise one.
Logged

web designer/programmer
------------------------------
Slider
Community Member
*
Posts: 1135


« Reply #2 on: May 17, 2004, 03:18:32 PM »

we want more.... we want more....
Logged

Slider is the name, and logic is my game...
Helping retards through life since 1981
tweakbox
Customers
Community Member
*****
Posts: 1194


« Reply #3 on: May 17, 2004, 04:03:07 PM »

what I love is that 3/4 of these things don't really even make any sense...
Logged

I want to make a puzzle with like 40,000 pieces, and when it's done, it says "Go Outside"
bbence
Customers
Community Member
*****
Posts: 943


WWW
« Reply #4 on: May 17, 2004, 04:37:51 PM »

Well, programming a point&click game is really easy:

1. create the 3D environment
2. create the objects the player will be interacting with
3. render them in 3D space
4. script the actions
5. you're all done.

 Cool
Logged
Josip
Community Member
*
Posts: 46


WWW
« Reply #5 on: May 18, 2004, 04:40:37 AM »

It's not that easy to make a pn'c adventure. I'm making something like Adventure maker. Maybe I could help, but be specific...
I'm just done with collision / path finding...  Cheesy
Logged

.:: Reality is illusion caused by lack of alchocol ::.
             .:: http://croarmy.gamer.hr ::.
Master-Andy
Community Member
*
Posts: 5


« Reply #6 on: May 18, 2004, 07:22:41 AM »

Hi!

When you click with the mouse on a position, the Actor must be go to this point!
The Mouse Postion is 2D and the World Position 3D! How must i do this!

Ciao Andy!
Logged
Eric
Customers
Community Member
*****
Posts: 804


« Reply #7 on: May 18, 2004, 08:35:58 AM »

mousepicking.
Logged
aliasx
Customers
Community Member
*****
Posts: 218


« Reply #8 on: May 18, 2004, 10:12:29 AM »

Ominous clicking sound!  Newborn shouts magazine.
Logged
rocky
Customers
Community Member
*****
Posts: 955


« Reply #9 on: May 19, 2004, 10:33:08 PM »

Tutorial B15: Advanced Collision Detection covers mouse picking where a model moves to the picked location.

This would be a good starting point for you.

Rocky
Logged
Master-Andy
Community Member
*
Posts: 5


« Reply #10 on: May 20, 2004, 05:46:42 AM »

Hi!

Thx Rocky! But this tutorial doesn't give it in Delphi!
But can you send me the Code per mail?(Master-Andy@web.de)
The Commands from the engine are the same, i think!

Ciao Andy
Logged
stodge
Community Member
*
Posts: 154


« Reply #11 on: May 20, 2004, 07:09:56 PM »

Andy, I have a complete engine that I spent 6 months writing, that does exactly what you want in Delphi. I can send you the code if you want.






NOT!!!   :twisted:
Logged

Slider
Community Member
*
Posts: 1135


« Reply #12 on: May 20, 2004, 08:05:01 PM »

This is the B15 tutorial code  Tongue
It shouldn't be too hard to convert it to Delphi.

Code:
' ------------------------------------------------------------
'  TrueVision3D Tutorials : . Advanced collision with meshs .
' ------------------------------------------------------------

'  Goal :
'   This tutorial shows how to do accurate collision on the scene
'   for a character. This is the base of every game, and quite simple
'   to understand and do. Note that you can replace the meshs by
'   any other mesh, and it will work the same.

'  Thanks to Yegveni team for the 3d character.


' Declare the engine objects.
Dim TV As New TVEngine
Dim Scene As New TVScene
Dim FloorMesh As TVMesh
Dim Actor As New TVActor2
Dim Land As New TVLandscape
Dim Tex As New TVTextureFactory
Dim Inp As New TVInputEngine

Dim Finished As Boolean

' Information about the movement of the actor.
Dim ActorPosition As D3DVECTOR
Dim ActorDestination As D3DVECTOR
Dim ActorDir As D3DVECTOR
Dim Moving As Boolean


Public Sub Initialize()
 ' Initialization and loading of everything.
 
 
 'Engine initialization.
 Me.Show
 DoEvents
 TV.Init3DWindowedMode Me.Picture1.hWnd
 TV.SetSearchDirectory App.Path + "\..\..\..\Media"
 TV.SetAngleSystem TV_ANGLE_DEGREE
 
 'Objects loading.
 Actor.Load "character.x", "actor", False, True
 Actor.SetMaterial 0
 Actor.PlayAnimation 20
 Actor.SetScale 0.2, 0.2, 0.2
' ActorPosition.x = 150
 'ActorPosition.z = 150
 
 Scene.SetSceneBackGround 0.7, 0.8, 1
 
 'Load the bridge mesh, that the character can go upon.
 Set FloorMesh = Scene.CreateMeshBuilder
 FloorMesh.LoadXFile "brige.x"
 FloorMesh.SetMaterial 0
 FloorMesh.SetCullMode TV_FRONT_CULL
 
 
 
 'Landscape creation.
 Land.SetFactorY 0.3
 Land.GenerateHugeTerrain "track.jpg", TV_PRECISION_AVERAGE, 2, 2, 0, 0, True
 Tex.LoadTexture "sand.jpg", "sand"
 Land.SetTexture GetTex("sand")

 ActorPosition.x = 150
 ActorPosition.z = 150
 ActorPosition.y = Land.GetHeight(150, 150)

 FloorMesh.SetPosition 100, Land.GetHeight(100, 100), 100


 'Camera settings
 Scene.SetCamera 400, 150, 350, 0, 150, 0
 
End Sub

Public Sub CheckAll()
      ' do input mousepicking on the scene.
      Dim mousex As Long, mousey As Long, button As Integer
      Inp.GetAbsMouseState mousex, mousey, button
     
      Dim Pick As TVCollisionResult
      If button Then
          Set Pick = Scene.MousePicking(mousex, mousey, TV_COLLIDE_LANDSCAPE Or TV_COLLIDE_MESH, TV_TESTTYPE_ACCURATETESTING)
          If Pick.IsCollision Then
              'the impact point is the new destination for the actor
              ActorDestination = Pick.GetImpactPoint
             
              'compute his new direction (in 2d so remove the y argument)
              ActorDestination.y = ActorPosition.y
              ActorDir = VNormalize(VSubtract(ActorDestination, ActorPosition))
              Actor.Lookat ActorDestination.x, ActorDestination.y, ActorDestination.z
              Actor.RotateY 180
              Actor.SetAnimationID 1
              Actor.PlayAnimation 50
              Moving = True
          End If
      End If
     
      ' now do the actor moving.
      If Moving = True Then
         ActorPosition = VAdd(ActorPosition, VScale(ActorDir, TV.AccurateTimeElapsed * 0.08))
         
         ' The Important Part : Accurate Advanced Collision detection.
       
         ' Get the landscape point below the actor
         Dim LandHeight As Single
         LandHeight = Land.GetHeight(ActorPosition.x, ActorPosition.z)
         
         
         ' GRAVITY TEST
         ' Do a vertical check from the player position + 10 to the landscape.
         Dim Coll As TV_COLLISIONRESULT
         Dim test As Boolean
         test = Scene.AdvancedCollision(Vector3(ActorPosition.x, ActorPosition.y + 10, ActorPosition.z), Vector3(ActorPosition.x, LandHeight, ActorPosition.z), Coll, TV_COLLIDE_MESH, TV_TESTTYPE_ACCURATETESTING, True)
   
         If test = False Then
           ' there is nothing else than landscape below the actor, so the actor must fall
            ActorPosition.y = ActorPosition.y - TV.AccurateTimeElapsed * 0.1
            If ActorPosition.y < LandHeight Then ActorPosition.y = LandHeight
         Else
           ' check the impact point of collision
           If Coll.collisionimpact.y < ActorPosition.y Then
             ' if impact is below actor, it must fall,
             ActorPosition.y = ActorPosition.y - TV.AccurateTimeElapsed * 0.1
             If ActorPosition.y < Coll.collisionimpact.y Then ActorPosition.y = Coll.collisionimpact.y
           Else
             'else it must go up
             ActorPosition.y = Coll.collisionimpact.y
           End If
         End If
         
      End If
     
      ' if we are near the dest point, just stop it
      If GetDistance2D(ActorPosition.x, ActorPosition.z, ActorDestination.x, ActorDestination.z) < 0.5 Then
         Actor.SetAnimationID 0
         Actor.PlayAnimation 20
         Moving = False
      End If
     
   
      If Inp.IsKeyPressed(TV_KEY_1) = True Then
         Scene.GetCamera.RotateY -TV.AccurateTimeElapsed * 0.02
       End If
   
       If Inp.IsKeyPressed(TV_KEY_2) = True Then
         Scene.GetCamera.RotateY TV.AccurateTimeElapsed * 0.02
       End If
       
     
      ' manage the camera
      If mode = 0 Then
         If Inp.IsKeyPressed(TV_KEY_LEFT) = True Then
           Scene.GetCamera.RotateY -TV.AccurateTimeElapsed * 0.02
         End If
     
         If Inp.IsKeyPressed(TV_KEY_RIGHT) = True Then
           Scene.GetCamera.RotateY TV.AccurateTimeElapsed * 0.02
         End If
         
         If Inp.IsKeyPressed(TV_KEY_UP) = True Then
           Scene.GetCamera.MoveRelative TV.AccurateTimeElapsed * 0.2, 0, 0
         End If
         
         If Inp.IsKeyPressed(TV_KEY_DOWN) = True Then
           Scene.GetCamera.MoveRelative -TV.AccurateTimeElapsed * 0.2, 0, 0
         End If
   
         If Inp.IsKeyPressed(TV_KEY_PAGEUP) = True Then
           Scene.GetCamera.MoveRelative 0, TV.AccurateTimeElapsed * 0.2, 0
         End If
         
         If Inp.IsKeyPressed(TV_KEY_PAGEDOWN) = True Then
           Scene.GetCamera.MoveRelative 0, -TV.AccurateTimeElapsed * 0.2, 0
         End If

     
      End If
     
End Sub

Public Sub RenderAll()

      If mode = 1 Then
        'put the camera above player
        Scene.SetCamera ActorPosition.x, ActorPosition.y + 200, ActorPosition.z + 200, ActorPosition.x, ActorPosition.y, ActorPosition.z
      End If
     
      'render
      TV.Clear
         Land.Render
         FloorMesh.Render
         
         Actor.SetPosition ActorPosition.x, ActorPosition.y, ActorPosition.z
         Actor.Render
      TV.RenderToScreen
End Sub

Public Sub MainLoop()
   Do
      ' Render everything to the screen.
      DoEvents
      RenderAll
     
      ' Do Input and physics check
      CheckAll
   
   Loop Until Finished = True Or Inp.IsKeyPressed(TV_KEY_ESCAPE) = True
   
   Set TV = Nothing
   End
End Sub

Private Sub cmdQuit_Click()
 Finished = True
End Sub

Private Sub Form_Load()
     Initialize
     MainLoop
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  Finished = True
End Sub
Logged

Slider is the name, and logic is my game...
Helping retards through life since 1981
Master-Andy
Community Member
*
Posts: 5


« Reply #13 on: May 21, 2004, 03:22:16 AM »

Hi!

Thx for the code!
Stodge when you will can you send me the code!

Ciao Andy!
Logged
a-dapt0hr
Community Member
*
Posts: 24


« Reply #14 on: May 22, 2004, 05:47:22 AM »

@Master-Andy:

If you not aufhör to benutz such an extreme english for runnaways I will see myself gezwungen to pick up my Schrotflinte and go on a Hatz somewhere in Deutschland. Especially die ganzen Rufzeichen annoyen mich einigermaßen, but that's only my opinion.

Nein, mal im Ernst, die Code-Samples geben ne Menge her. In Delphi kenne ich mich nicht aus, aber so winzig, wie die Samples sind, sollte es keine große Sache sein, sie umzubauen.

Nebenbei, was Stodges Posting angeht: Man sollte einen gewissen Ironie-Detektor besitzen, Andy.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks