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! / 2D Side scroller tutorial

Author
Message
Darth Vader
21
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 7th Feb 2006 02:27
I am in need of a 2D Tutorial. What I need is the following:


Left and right capibilities
able to shoot some sort of weapon
Able to let enemies move towards player (with basic AI)
scrolling screen



Thanks in Advance!

You Don't know the power of the Dark Side!!
Oh but I do!!
General Sephiro
21
Years of Service
User Offline
Joined: 27th Sep 2004
Location:
Posted: 7th Feb 2006 05:47 Edited at: 7th Feb 2006 05:52
I shall only lend knowledge, not the code itself.

Moving / scrolling screen:
Left + Right, If player uses arrow keys left or right, speed# will equal 0.09 for right or -0.09 for left

Then you scroll the backgrounds X value by speed#, remembering to reset the speed value back to 0 after this so it doesn't continue scrolling when you stop moving...

Shooting:
If Weapon Fire = 1 then you make the projectile face the direction the gun was aiming, and keep moving it forward until it's out of the screen

Basic AI:
If PlayerY value is greater than computerY value decrease the computerY value
Same with X, then do the opposite for both x and Y
That will just make the "Computer Player" move towards your character


E.g.
____________________________________
---Player1
---()x=50

---------------Computer1
---------------() x = 200
____________________________________

Since the computer x value is greater than the player x value it will decrease the computers X value to move it left *towards the player*

Paisleys finest
20
Years of Service
User Offline
Joined: 11th Nov 2005
Location: In a house
Posted: 7th Feb 2006 13:21
On this very website you can download the L-Type demo game, written in DarkBASIC. It's a side scroller with all the things you mention.

In fact, I'm pretty sure it comes with DBPro, as a sample app.

If not, I'm sure if you search here, you can find it.

Current work in progress: Retro Remake of BRUCE LEE, by Datasoft (1984)
Computer Nerd
21
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 28th Feb 2006 16:31
Search the codebase amigo, I may do a scroller tutor later though.


Finished Projects - Dark Icon(you will never see this one!)
Current Project - ???

Login to post a reply

Server time is: 2026-07-02 01:26:35
Your offset time is: 2026-07-02 01:26:35