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.

2D All the way! / Class aware of another class

Author
Message
speede
13
Years of Service
User Offline
Joined: 22nd Oct 2010
Location: UK
Posted: 19th May 2011 22:22
Hello everyone

The problem that I am facing at the moment is how to make classes communicate with each other.

I am making a game with different classes and so now I have got the player, background and enemy. I have made a background and I am trying to paste it behind the player so he can walk on its surface. Unfortunately when I create the background class, my character disappears from the screen. I know that the player is behind the background, because I have used the dbShowSprite and dbHideSprite function. I have also tried to use dbSpritePriority to make my character a 1st plan sprite - it never worked. I have played around with creating the background before or after I create my sprite, but still background always stays at the top. Do you know why?

P.S. I am sorry for so many topics requesting help, but I guess that everyone has to learn these things one day and I can see I am only getting better in finding solutions to my problems


Background.h


Background.cpp


Cyclops.h


Cyclops.cpp (player)


Main.cpp
DeadTomGC
13
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 20th May 2011 05:24 Edited at: 20th May 2011 06:02
One way to get around this would be to move the
to after
.
I don't know why this
wouldn't work though.


Login to post a reply

Server time is: 2024-02-29 08:38:10
Your offset time is: 2024-02-29 08:38:10