Jump to content

  • Log In with Google      Sign In   
  • Create Account


Lazy Foo's Tutorial 17 (Collision Detection)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Motoky   Members   -  Reputation: 168

Like
0Likes
Like

Posted 03 May 2013 - 05:41 AM

Hey, I am currently working through Lazy Foo's tutorials. I have been doing pretty well with the previous tutorials. Obviously running into walls, but managed to get passed them due to silly little errors or mistakes I couldn't see which were to blatant when I finally did find the problem...

 

Anyway, the problem I am having is with the Timer class. I've got it working in previous projects, but it's just cooperating in this one project.

 

The function I am talking about is it returns the time in milliseconds, but it is all based on whether the timer is running and if it's paused or not.

 

 

I have uploaded my project. It's probably not perfect, but I am just trying to get it up and running before I make modifications, add more comments and such. I can't seem to copy and paste code properly, it just comes out as a jumbled mess with huge gaps between nearly every word and it would take me ages to sort it out, so it just quicker to upload my project and you can have a look through it all.

 

Like I said, it's just the Timer class giving me trouble. It just stops at the getTicks() function when I debug. It stops at the first line in that function which is:

 

if(started == true)

 

 

Now this exact class works in other projects.

Attached Files



Sponsor:

#2 Wooh   Members   -  Reputation: 567

Like
0Likes
Like

Posted 03 May 2013 - 06:39 AM

You have not initialized the fps pointer in SDLManager. I don't really see the why fps should be a pointer in the first place.

#3 Motoky   Members   -  Reputation: 168

Like
0Likes
Like

Posted 03 May 2013 - 06:55 AM

I had a look through my code before looking at your reply and I noticed I hadn't even started the timer. I also initialized a Timer object in my Main source file along with the SDLManager header file. I was trying to start the timer with a different Timer object, but retrieve the FPS on another Timer object...

 

I decided to initialize my timer in my Main source file, get rid of it in the SDLManager. The program is up and running now, but still having a little trouble with the movement of the square, but I will sort that out myself. I've had this problem before and I managed to get it fixed before.

 

 

Thanks a lot though.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS