Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 Tron Game

Status
Not open for further replies.
May 25, 2022
2
0
0
CA
I am having difficulty with a school assignment. We have to create a Tron game and I am having trouble with the part where if a player hits their or another player's trail, it is game over. The teacher told us that we should use intColour = CStr(PictureBox.Point(intX, intY)) and checking whether the intColour matches a trail colour. The problem is though that I am constantly hitting my own trail. The code I have written so far is down below. I added a file to make it easier. The file attached below is the work I have done so far.
 
 https://files.engineering.com/getfile.aspx?folder=f3102f84-8832-44a4-b01c-9e9a7ae53d9a&file=VB7_Tron_Simulation_-_Form_File.frm
My first guess would be that you are checking the trail colour AFTER you have moved, which means you will be peeking at your own colour. I'll have a quick look at the code you have provided when I get a moment to see if this is confirmed ...
 
Yep, that's pretty much what is happening. You need to do the check in [tt]tmrGamePlay_Timer[/tt] before you call [tt]picField.PSet (intUserX, intUserY), RGB(66, 135, 245)[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top