Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Camronas
16
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 9th Jul 2010 12:11
Hey jusy trying to amke a platformer game for school, this is what iv got so far



Just wonder if this code if good, or if there are anyways to improve it. Ill need some more help later and at the moment this works but I want to learn good codeing so i can work witha higher standard, thanks
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 9th Jul 2010 13:27
Looks pretty good IMO, your not doing anything silly, like creating objects in the main loop, which often is the case with posts like this.

I'm assuming that it runs at a nice, steady 60fps? - can't really think of anything that I'd change unless things start to chug when you add more objects, in which case I'd look at the collision detection, maybe switch to Sparky's as that is faster and better optimised than the built in collision system.


Health, Ammo, and bacon and eggs!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Jul 2010 13:44
I can see one line that I'd rewrite:


DBPro doesn't do shortcut evaluation on checks like that, so it'll carry out every part even when it's not logically necessary. I'd split it into 2 IF statements, putting the 'expensive' check into the second:


Apart from that, there's nothing to improve performance-wise.

Camronas
16
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 9th Jul 2010 16:41
Ok well, now that that seems good, I have question lol, when my player is moving around he stops on the terrain which is good, my issue is when hes jumping he can move through the area on the sides. How do I fix this?

Login to post a reply

Server time is: 2026-07-25 08:13:18
Your offset time is: 2026-07-25 08:13:18