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.

DarkBASIC Professional Discussion / [Need Help] 2D Side Scrolling Game

Author
Message
summerfed
15
Years of Service
User Offline
Joined: 14th Jun 2011
Location:
Posted: 14th Jun 2011 18:11
Hi there I want to make Maple Story Type of Game in Darkbasic as a requirement for our Thesis Here is my work so far



My Problem is that how to display monsters in the screen and store character stats and monster stats. And Please tell me if you have something to suggest me (ex. tutorial) Thank you. All the help is much appreciated. I really need to do this to complete my Degree. Thank you
Non Sequitur M
17
Years of Service
User Offline
Joined: 28th Oct 2008
Location: Where am I!? Where are YOU?
Posted: 14th Jun 2011 19:27 Edited at: 14th Jun 2011 19:28
Well, your store monster and player stats problem is simple. User Defined Types and Arrays.

Arrays are the more simple of the two. Arrays work like a grid of data. You can start an array with the 'dim' command. Here is the syntax:

The way this syntax works is, you create an array, and can name it almost anything(don't use command names like 'wait' or 'sprite', although 'waiting' or 'sprite_data' will work). Then in the parentheses, the numbers work sort of like a grid. So, if you put 'dim plstat( 2 , 1 , 3 )', it would make a grid with 3 blocks(it counts 0 as 1, 1 as 2, etc.) of data, divided into 2, and each of those 2 in turn divided into 4. So, to store a piece of data in that, you would use something like this:

And, retrieving it is just as easy.

That way, you can store data in clusters.

Here's where it gets fun. User Defined Types, or UDTs. I would suggest these to store your data. These are a little more complicated to use. So, I'll just link to a good tutorial:
http://forum.thegamecreators.com/?m=forum_view&t=110324&b=7
Thanks go to Zotoaster for that one. Although, he doesn't cover the variable types you can dimensionalize. Here they are:
boolean
byte
word
integer
dword
float
double integer
double float
string

Just type them in by name in DBPro's editor, and the editor will tell you how big each is. Use the one that's the most appropriate for your need.

Hope this helps,
-Amo.

If the universe isn't a program, then why do planets orbit in loops, death sparks life, and human interaction is buggy and glitched?
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 15th Jun 2011 06:58 Edited at: 15th Jun 2011 06:58
@ Amo Deus Man:

I know you mean well but since he's a newbie you should of started with a 1D array instead of going straight to multi-dimensional arrays.


@ Summerfed:

Skimming over your code it looks great but I noticed you're using SCANCODE(). SCANCODE() is really designed to just learn the KEYSTATE() of a key because SCANCODE() only returns the lowest numbered key that's being pressed so you cannot use it for multiple keys at the same time. With KEYSTATE() you can use as many keys as your keyboard allows.

So instead of this:


Do this:


And don't be afraid to put in a lot of REM statements. The more remarks in your code the easier it is to determine what's going on at a glance if you stop a project and go back to it a month, year, or even 20 years later.

Check out TDKs Tutorials where you can learn the basics of Darkbasic (including arrays).

http://forum.thegamecreators.com/?m=forum_view&t=99497&b=10

I must say though your code looks good. Keep up the good work.

summerfed
15
Years of Service
User Offline
Joined: 14th Jun 2011
Location:
Posted: 16th Jun 2011 01:42
@Amo Deus Man:

Thank you sir, for the reply,

@Grog Grueslayer:

Thank you sir for the advice, the subject I am having difficulties now is how I can display enemies into the game, What is the method I am going to use, Thank you Sir.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 16th Jun 2011 07:20
Just like Amo Deus Man suggested use an array to store the information. Instead of using actual sprite numbers use an array to store the sprite numbers so you can have multiple enemies on the screen at once.

Non Sequitur M
17
Years of Service
User Offline
Joined: 28th Oct 2008
Location: Where am I!? Where are YOU?
Posted: 17th Jun 2011 00:12
My bad. Jumped the gun a little. I've never been that great of a teacher...

Yes, experiment with 1d arrays first. Then when you understand those and feel comfortable with them, come back to this thread, and then experiment with what I posted.

If the universe isn't a program, then why do planets orbit in loops, death sparks life, and human interaction is buggy and glitched?
summerfed
15
Years of Service
User Offline
Joined: 14th Jun 2011
Location:
Posted: 22nd Jun 2011 17:38
I already understand how to use arrays and User define types, but I am having hard time figuring out how can I apply these attributes to my enemy sprites. please give me a sample code on how to apply these ideas to sprites. Any help would be so much appreciated. I really really need to finish this project as my thesis. Thank you. I attached my work so far. Please help me. Thank you

Login to post a reply

Server time is: 2026-07-11 02:14:10
Your offset time is: 2026-07-11 02:14:10