Also this is a very noob question… but I am currently adding my player in the world class with this line… what would I have to do to be able to access the X and Y value of the player from the world class?
add(new thePlayer);
Also this is a very noob question… but I am currently adding my player in the world class with this line… what would I have to do to be able to access the X and Y value of the player from the world class?
add(new thePlayer);
The only difference is mine is called player, and yours is thePlayer, so replace the player accordingly.
Okay I have addressed all of the player issues, but I am not sure what to put for mapWidth and mapHeight. I tried manually putting in the stage information but that then made my character move from spawn.
Okay everything is compiling but I am not sure what to do for mapWidth and mapHeight still! D: My character is moving and such, the camera doesn’t follow him though.
You could do it manually if all your levels are going to be the same size, but what i’ve done is set the variables from the ogmo level file when I load it.
Okay! I just figured it out! I had manually set the width to the size of the stage so it wasn’t doing anything! But it is now working! Thanks a lot Shadow!
My next question is going to be inserting a nice scrolling backdrop which will mainly just be clouds and such!
That sounds like a problem with accessing the x and y of your player. Can you post your whole world file?
I got everything workin! In order to access the X and Y coordinates of my player class, inside of my world class I used these four lines of code, in their respectful places:
import entities.thePlayer;
private var hero:thePlayer;
hero = new thePlayer;
add(hero);
Then in order to access the X and Y coordinates in the camera code I used hero.x and hero.y respectfully!
Glad to hear it!if you don’t want to have to set it manually because you have different level sizes let me know. Glad I could be of help!
Okay! Thanks again for the assistance Shadow!
What would you suggest for me to insert some clouds to float by in the backdrop area?
If you want them to move independently of the walls and such, I have code for a scrolling BG in another of my games, but I won’t be able to post it for a few days I work tomorrow and then have plans as its my b-day, but ill post it as soon as I can. It consists two copies of the background that scroll, and leapfrog over each other as they go off screen.
Also, another thing that could be cool, is you could have a few cloud objects that get moved to a random y location on the right side of the screen when they move off the left. This would look lest repetitive. Then you could have a solid blue BG behind them.
Yea I was thinking to have some random clouds generated at different Y values and then have them move across the screen at a fixed slow rate.
Sweet. If you need help with that let me know and I’ll help you out as soon as I can in a few days.
Just coded that in my current game, its nice if you have a base speed, then multiply that by each clouds image scale - looks pretty cool that way.
Shadow I will shout if I need anything! Thanks again for hooking up the scrolling code!
HuckleberryWill! I will look into doing something like that for my clouds, thanks!
Hi, i just tried to implement this but when i created a override update function in my world.as my hero entity froze. so i dropped it off and put the 2 fp.camera lines in the update function of the hero.as but after this the hero just dissappeared off the screen. what did i wrong?