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.

Newcomers DBPro Corner / 2D Side scroll Levels

Author
Message
BeastDeath
13
Years of Service
User Offline
Joined: 7th Jul 2011
Location:
Posted: 6th Oct 2011 23:05
Ok I'm at the point where I need to create the levels. I've made it so the background moves instead of my player when I press the arrow keys, to give the effect that the player is moving.

What would be the best way to make my level out of sprites? With collision support and be able to side scroll. I'm making a top down zombie shooter, it also includes AI, bullets, do I move these as well if I don't move the actual player?

If I make it so when I move the keys I want to move the background and the AI's how would I make it so the AI's move on their own without effecting it when pressing the keys to move the player?

I create them on the screen by calling a loop outside the do loop. Then Update them inside the do loop. Here's some simple code so far:



Any tips?
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 8th Oct 2011 04:07
Hi BeastDeath, unless I'm mistaken, you are using the same sprite number for 11 different objects? This might be a bit disasterous as you progress so what I recommend doing is instead of:

Zombies(x).ID = ZombieID

have

Zombies(x).ID = ZombieID + x

This way, each object of your array will have it's own sprite number.

Quote: "I'm making a top down zombie shooter, it also includes AI, bullets, do I move these as well if I don't move the actual player?"

I think you would need to move them.


Quote: "how would I make it so the AI's move on their own without effecting it when pressing the keys to move the player?
"

I think you would just give them their own movement function(s) and then alter their final x,y values according to the player's input.

Quote: "What would be the best way to make my level out of sprites?"

Depends on how you've designed your game so far. Have you got one giant background image or a bunch of small images that can be used like tiles? By answering that question you might be able to work it out yourself.

Good luck with your game.

nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 8th Oct 2011 11:21
Quote: "
What would be the best way to make my level out of sprites? With collision support and be able to side scroll. I'm making a top down zombie shooter, it also includes AI, bullets, do I move these as well if I don't move the actual player?
"


Hodgey is right, you must move things.

If the player is "moving", entities will get closer and further from "him". So that means if your player is static and the background is moving, so must you adjust the position of all entities (Incl. zombies) accordingly. But that is an easy thing to handle



The Pros to this method: It's really easy.

The Cons: Using sprites for a background that is too big can be resource-intensive. My game was small so I got away with it

Solutions (If the cons are a problem):
1. Split your backdrop into sections. Then write functions to destroy and create various sections based on the player's ACTUAL position (Screen position is static).
2. Use a textured 3D plane as a backdrop and sprite background entities onto it (eg a dumpster, a car, etc). You'll have to find the correct ratio when moving the backdrop VS the entities to ensure alignment but it can be done.

AS FOR BULLETS: They'll be handled in the same manner as any other entity apart from the fact that they'll be moved as well.
AI IS EASY: Simply make a call to a zombie handler inside you game loop.

If there's something unclear about what I said, let me know, I'm not always a rockstar at explaining what I'm thinking.

PS: Sorry my reply is so verbose.

Login to post a reply

Server time is: 2024-11-24 02:05:43
Your offset time is: 2024-11-24 02:05:43