Help debugging

11-20-2001, 08:22 PM
I am making something that will be the base of a game. It is a sort of universe which can be viewed by 'moving' the viewing area around. You can see this better by looking at the code I have attached. The problem is when scrolling around the comets appear to show up in strange ways, again, it's easier to see this by looking at my code. I would like to be able to fix this without changing the Relative positions of the comets because it will need to stay the same in the future of the game. If anyone can help or suggest a better way to accomplish something like this, please let me know. Thanx.

wild wolf
11-20-2001, 09:41 PM
dun mind but ur question sounds very vague, i looked at ur code, i think u should say something more on the problem, do u mean that when u move down, the comets dun appear (coz thats what i noticed) or is it something else

11-20-2001, 09:43 PM
Yeah, I wasnt quite sure how to word it, but if u move say right and then down, comets do not appear, and then if u move left they show up again. There is also a case where all the comets get flattened into the top few lines until u press another direction. Hope this is a bit clearer...

11-21-2001, 06:46 AM
OK, I've had a look and I've found the bugs. I have posted the revised code and I shall explain it here.

The one where the comets gradually disappeared was to do with the adjustment to BottomRightY and TopLeftY. You were adding when you should have been subtracting and vice versa. The thing to remeber is that in VB the y scale runs top to bottom not bottom to top.

The bug where comets compressed along one edge was caused by the position of the view calculation. You were only calulating the view position if the comet was currently visible. Say you move down. The comets that are off to the right do not get their Y view positions updated and so when the view is moved right they are not in the correct position (because the y view is not calculated in a left-right
The solution was to move the view calulation outside the if statement so that it now gets calculated for every star for every movement.
Another solution is to leave it inside the if statements but do both x and y view calculations regardless of movement direction.

11-21-2001, 06:47 AM
Sorry, here it is.

11-21-2001, 07:22 AM
ahhh, thanx. Will keep that in mind in the future.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum