Locking Up

trevland06
03-23-2002, 05:07 PM
I have made 2 games now but everytime i run one of them it seems that they all lock up. for Pong it makes it work up until it gets to make the ball and paddle to put on... And then it doesnt work. they keys dont work on it either (escape, up and down etc.). i made it make the sprite but i took out the rending part because there is no animation to it and it kept being a pain with errors. that could be the problem though. then. for my monster shooter game. it s done but when it loads the game i have 2 forms. one where you press the button. Start. Then once that form is hidden. They are both invisible and it freezes my pc. what should i do?

Thinker
03-23-2002, 06:42 PM
You need to learn how to debug a program.
Look here for a tutorial on how to debug in VB. (http://www.visualbasicforum.com/showthread.php?s=&threadid=9415)

andreww
03-23-2002, 06:45 PM
add DoEvents into the loop

trevland06
03-23-2002, 09:11 PM
i did add doevents

Volte
03-24-2002, 07:56 AM
Well, you could post your project here so that we can get an idea
of what might be wrong. Without seeing some code, this is just
a guessing game for us.

trevland06
03-24-2002, 10:53 AM
okay here they are.. i tried the debugging tutorial but i dont know whats wrong with it since it just runs without showing any error.

Thinker
03-24-2002, 11:03 AM
The point of debugging isn't just figuring out run-time errors, it is
learning how to step through code, checking values of variables to
make sure the program is doing what you think you programmed
it to do. By setting a breakpoint on a sub that doesn't seem to be
performing correctly, you can execute one or more lines of code,
then check a variable. Or you could set a watch where the code
will break if a variable reaches a particular value. No one ever
gets any good at programming without learning to track down
why a program isn't doing what they want it to.

Iceplug
03-24-2002, 01:03 PM
You can press Ctrl-Break to enter pause mode if you are caught in an infinite loop somewhere.

trevland06
03-24-2002, 02:54 PM
okay. but how do i make my game work?

Volte
03-24-2002, 03:01 PM
We can't just explain how to make it work... we don't even know
what the problem is.

Try this:

Run your game, and wait until it locks up. Press Control-Break to
go into debugging mode, and look to see where the yellow
highlighted line is. If it's inside a loop, you're most likely caught
inside of it. Look over the loop to see if there is any variable
that is not being incremented or anything, or any spelling errors.

Also, is Option Explicit at the top of your code? If it's not,
then put it there and see if your code gives you any 'Variable
Not Defined' errors.

Edit: oh, I see you posted your code. :) I missed that. I'll look
at it and see what I can do.

Iceplug
03-24-2002, 03:11 PM
I looked at pong.frm and saw:
Arrangescreen
Show
Mainloop
MakeBar
MakeSprite

The MainLoop function never terminates, so MakeBar and MakeSprite should be called at least before MainLoop.
I also couldn't find a function that calls Mleft or Mright.
I saw something similar in shootout.frm, but the DoEvents should be inside the loop. The MsgBoxes after Do...Loop in the Form_Load also come after the MainLoop function, which doesn't terminate.

trevland06
03-24-2002, 04:58 PM
k thanks ill try it out

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum