Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Please Help! , Grade 10 ISU - Lag issues
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tttptiago




PostPosted: 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.



supermario.jpg
 Description:
 Filesize:  3.07 KB
 Viewed:  1123 Time(s)

supermario.jpg



GAME-RACE.t
 Description:

Download
 Filename:  GAME-RACE.t
 Filesize:  2.29 KB
 Downloaded:  79 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Albrecd




PostPosted: 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.
rollerdude




PostPosted: 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
tttptiago




PostPosted: 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 ?
Albrecd




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: