|
|
#1 | ||||||||
|
Junior Member
Location: colorado |
Hello, this is my first ndeavour in game programming and am the only one working on this project
![]() I was able to restrict movement of the player within a rectangle (no problem) but what I’d like to achieve is a sense of depth where as I move up I am actually moving upstage as well. This is hard to grasp as I am using sprites on a background. The earliest game that I can think of that is a good example is double dragon. I am using xna |
||||||||
|
|
|
|
|
#2 | ||||||||
|
Moderator
Location: Netherlands |
So what is the problem exactly? If you can get a sprite to move horizontally, surely you can also get it to move vertically. (This is how the sprites in Double Dragon move between 'stages', as you call them.) Alternatively, it might look good to to draw different sprites for moving vertically (sprites faced towards the screen and away from the screen) and/or slightly scale the sprites in accordance with perspective (moving towards the screen the sprite should grow in size, away it should shrink).
That's just my two cents for now, but your question is a little confusing.
__________________
I'm a web developer by profession, but a game developer by heart. Uh oh! The princess is in another signature! |
||||||||
|
|
|
|
|
#3 | ||||||||
|
Junior Member
Location: colorado |
Well it is a matter of layer depth simulation, if a GameObject’s Y value less that other GameObjects I’d like to draw them first. The tutorial spawns enemies from the right and scrolls them left, and it looks really bad when enemies are drawn over others when they shouldn’t be.
Yes, I’ve talked about different art for moving up and down with the person who is drawing my batches. I just recently discovered effects.horizontalflip so my animation works in both left/right movement. I got a fire weapon animation to work with as well. The problem at hand is in this block I believe foreach (GameObject enemy in enemies) { if (enemy.alive) { spriteBatch.Draw(enemy.sprite, enemy.position, Color.White); } } As it gives no layer precedence in the draw up date |
||||||||
|
|
|
|
|
#4 | ||||||||
|
Moderator
Location: Netherlands |
I'm no expert, but what I'd do is maintain a sorted list that contains your sprites in the order that they should be drawn. Then, instead of simply doing a foreach, traverse your sorted list front to back and draw each sprite/enemy in the encountered order.
It isn't difficult maintainting the sorted list; in general, you can simply sort the sprites on the y-coordinate.
__________________
I'm a web developer by profession, but a game developer by heart. Uh oh! The princess is in another signature! |
||||||||
|
|
|
|
|
#5 | ||||||||
|
Junior Member
Location: colorado |
that works like a dream, thanks! Now on to collision that also has depth
|
||||||||
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.6.9
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
All times are GMT -8. The time now is 02:29 PM.





















Linear Mode

