|
-
May 20th, 2010, 04:45 AM
#1
Thread Starter
Junior Member
[RESOLVED] Need Help for point and click game
Hi,
For my high school project i need to make a game and i am trying to make it point and click style, i'm am have problems making it stop at a certain location, i can make it so it go straight to were the mouse is clicked but i want it so i click and it moves there then it stops, any help well be appreciated, thanks, Nevets_rulz123
P.S, sorry for bad spelling.....
-
May 20th, 2010, 08:12 AM
#2
Re: Need Help for point and click game
Welcome to the forums...
Did you tried coding something ? If so, show us your code...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
May 20th, 2010, 08:15 AM
#3
Lively Member
Re: Need Help for point and click game
You would want to use a Do loop, such as...
Code:
Do While x < PointClicked
Character.Left = x + 1
Loop
Of course that isn't the entire solution. You'd want to check for the current position of the character to decide if you need to go backwards or forwards, up or down
-
May 20th, 2010, 08:37 AM
#4
Fanatic Member
Re: Need Help for point and click game
Check out the ,Drag & Drop Game, link below. Thi s may offer you some ideas.
Alpha Micro: Alpha Basic, AS400 V5r2, EDI (Trusted Link/ Inovis.com),Access AS/400 via VB6, Qbasic for data conversions. A mix of Hardware too. ASCII Table , New Number to Words/66 digits , AS/400(v5r2) VB6 Viewer/Ask for code(ODBC) ^ What Is Transferring? , Check your Ports #Perfect Passwords , *Slide Bar Example , Logoff, Restart, Shut-Down PC *Keep Form On Top , Opaque Form ^ Create Objects at Run Time @ Check Key Caps Locks # GetTickCount(System Up Time) * Convert text to Excel & Collected Icons + Resize: Form/Text box ^ PC GateWay via Shell $ Drag & Drop Game ! PopUpMenu *Print File/no Open# Timer on Mult Forms ~ Splash & Mult Forms & Lots of Comments + Random/Timer/Guess * Dec >Hex >Oct >Bin % Get MAC (NIC) < saving to Registry > Wookiee Cookies \ BackUpDisk / World Conection SpeedTest $ Glossary Commonly Used Terms # phonetic list @ Detailed Computer Scan
When posting Code, Use tags.. [CODE] *Your Code* [/CODE]
-
May 21st, 2010, 12:42 AM
#5
Thread Starter
Junior Member
Re: Need Help for point and click game
this is my code
Dim xpos As Integer
Dim ypos As Integer
Dim Xtarget As Integer
Dim Ytarget As Integer
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
xpos = X
ypos = Y
If Button = 1 Then
Xtarget = X
Ytarget = Y
End If
End Sub
Private Sub Timer1_Timer()
Shape1.Move Xtarget
End Sub
Private Sub Timer2_Timer()
Shape1.Move Xtarget
End Sub
this makes it appear in the clicked location however it doesn't make it go up or down for some reason.... only horizontal
P.S, thanks for all the help
-
May 21st, 2010, 12:56 AM
#6
Re: Need Help for point and click game
Try this code:
Code:
Option Explicit
Dim Xtarget As Long
Dim Ytarget As Long
Dim revX As Boolean
Dim revY As Boolean
Dim xReached As Boolean
Dim yReached As Boolean
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 50
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Xtarget = CLng(X)
Ytarget = CLng(Y)
If Xtarget > Shape1.Left Then
revX = False
Else
revX = True
End If
If Ytarget > Shape1.Top Then
revY = False
Else
revY = True
End If
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If revX = False Then
If Shape1.Left < Xtarget Then
Shape1.Left = Shape1.Left + 50
Else
xReached = True
End If
Else
If Xtarget < Shape1.Left Then
Shape1.Left = Shape1.Left - 50
Else
xReached = True
End If
End If
If revY = False Then
If Shape1.Top < Ytarget Then
Shape1.Top = Shape1.Top + 50
Else
yReached = True
End If
Else
If Ytarget < Shape1.Top Then
Shape1.Top = Shape1.Top - 50
Else
yReached = True
End If
End If
If xReached = True And yReached = True Then
xReached = False
yReached = False
Timer1.Enabled = False
End If
End Sub
.....
Last edited by akhileshbc; May 21st, 2010 at 01:00 AM.
Reason: added some space to make it readable
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
May 21st, 2010, 02:16 AM
#7
Thread Starter
Junior Member
Re: Need Help for point and click game
Worked like a charm Thanks so much
-
May 21st, 2010, 03:44 AM
#8
Re: Need Help for point and click game
You're welcome...
If the problem is solved, please make sure to mark the thread as RESOLVED (you can use the Thread Tools found at the top of this page)
Good luck...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|