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! / problem with sidescrollers

Author
Message
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 4th Jan 2009 16:33
ok so i'm making a mario type sidescroller but when i put in enemies and stuff that moves it doesn't work correctly because the way i'm doing the side scrolling is i'm moving the Hole Ground Sprite on the X when it gets to a certain point. rite now i put the frames into the ground sprite so then i'm just changing the ground image but then i can't delete the enemies and it would require alot of ground sprites hahaha


if you want the code i can post it.
Destrugter 1
17
Years of Service
User Offline
Joined: 26th Oct 2006
Location:
Posted: 4th Jan 2009 16:53
Don't delete the enemies. I found out a while back that DBP doesn't have very powerful deleting and loading for sprites. What I would do, is since you are obviously going to be using a lot of the enemies again, I would simply offset it somewhere offscreen...maybe like 800x800...that is of course assuming your game is using the 640x480 resolution.

That's what I do now...maybe it isn't the best practice, but it's the only way I know of currently to effectively do this AND keep your performance.
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 4th Jan 2009 23:32
for one i'm using dbc.
2. ya that would be a better idea.
3. got any ideas on how to keep the enemy movement while moving the hole ground?
Mr Kohlenstoff
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 5th Jan 2009 13:38
For sidescrolling-purposes the best idea might be to do all calculations and stuff within world-space (ignoring any kind of scrolling), and just use the Scroll-Value/Camera-Position for drawing-operations from worldspace-objects. Thus collision etc. would be calculated compeletely without being influenced of the current camera-position, but pasting enemies would look somehow this way:

paste sprite Enemy(ID).SpriteID, Enemy(ID).x - camera.x, Enemy(ID).y - camera.y

where camera.x and .y define the draw-offset. To bind this camera to a player you'd do something like this:

camera.x = player.x - screen width()/2
camera.y = player.y - screen height()/2

which would make the point player.x|player.y always be in the screen's center.

Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 6th Jan 2009 02:01
um you lost me lol sorry i'v never been very good with the math part lol

Login to post a reply

Server time is: 2024-04-19 13:48:39
Your offset time is: 2024-04-19 13:48:39