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.

Dark GDK / Help sprite does not show up

Author
Message
Discan
15
Years of Service
User Offline
Joined: 5th Aug 2009
Location:
Posted: 6th Aug 2009 20:33
I am trying to make a 2D sidescroller but I got the code, added backdrop and a player and stuff but when I run, play the game I only see the backdrop moving but no player.

Player.cpp


Player.h


Input.cpp


Input.h


I also have code for backdrop and main, I can supply them if needed. I will be online for the following hours but leaving tommorow so if anyone has any ideas ? I think it's the positioning of the sprite the coordinates are wrong ? If so does anyone have some code snippet so it prints coordinates of my mouse icon when I hover around so I can place sprite accordingly ?Thanks.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 7th Aug 2009 05:38
Debug Code for displaying mouse co-ords/info :


ideally, you would allocate the memory once, somewhere before you are going to use it obviously(just before you enter main loop), and delete it after you have finished with it(just after main loop exits). Alternatively you could allocate/deallocate in the loop but I think that may not be a very good practice for memory management.

If it ain't broke.... DONT FIX IT !!!
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 7th Aug 2009 05:58 Edited at: 7th Aug 2009 06:04
@Mista Wilson

I smell memory leakage!

dbStr() allocates memory each time it is called, so if it's not handled properly, it will cause memory leaks.

Here is a better way to achieve what you need.



Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
Discan
15
Years of Service
User Offline
Joined: 5th Aug 2009
Location:
Posted: 10th Aug 2009 18:01
wow this problem was so easy to solve from the first ... each code I've used to display my coordinates apparently worked...the problem was that it appeared BEHIND the backdrop .. only when I disabled the backdrop I could see it.. thanks

Login to post a reply

Server time is: 2024-10-01 10:35:48
Your offset time is: 2024-10-01 10:35:48