Computer Science Canada

Please Help! , Grade 10 ISU - Lag issues

Author:  tttptiago [ Thu May 24, 2007 8:02 am ]
Post subject:  Please Help! , Grade 10 ISU - Lag issues

am having difficulty with my grade 10 ISP, please help.
Any improvements to my code will be apreciated.

The code seems to be lagging whenever my object moves. And help is needed inorder to create borders so that the car does not move off of the road.

Author:  Albrecd [ Thu May 24, 2007 2:04 pm ]
Post subject:  Re: Please Help! , Grade 10 ISU - Lag issues

The reason it's lagging is because of the for loops in the procedure bg.
You should try to paint these parts of the background with Draw.Fill objects instead of colorback.

Alos, something else I've noticed is that when you change directions, the next step will be in the previous direction. This is because in the code:
code:

if key = (KEY_UP_ARROW) then
        cls
        bg
        Pic.Draw (pic, x, y, picMerge)
        y := y + 13

you're drawing the picture before changing the coordinates, so your move doesn't take effect until the next button is pressed.

You could probably also decrease lag in the movement by using Input.KeyDown instead of getch, but you'd need key to be an array char of boolean instead of a string.

Author:  rollerdude [ Thu May 24, 2007 2:10 pm ]
Post subject:  Re: Please Help! , Grade 10 ISU - Lag issues

ic ur problem.... when u draw ur backround, use drawfillbox's rather than put" "..

this would go faster than befrore, because it doesn't have to go thru for loops... just one draw command

Author:  tttptiago [ Thu May 24, 2007 3:27 pm ]
Post subject:  RE:Please Help! , Grade 10 ISU - Lag issues

thanks! ... so far so good, I've eliminated the lag etc. Now that I've gotten that out of the way, I've been trying to set up the track so that the car appears to be moving forwards...anyone know how this is done ?

Author:  Albrecd [ Fri May 25, 2007 11:45 am ]
Post subject:  Re: Please Help! , Grade 10 ISU - Lag issues

I would suggest adding dashed lines to the center of the road, and then alternating between 3 or more backgrounds with the lines in different places.


: