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 Discussion / A turn system?

Author
Message
Zeus
17
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 23rd Jun 2009 06:20
Okay so here was my attempt at a turn system,



did not work. How can I modify this code to make it run more stable and integrate a turn system into it?

Thanks!
Zeus
Zeus
17
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 23rd Jun 2009 16:26
Please, I have a four day deadline for this. I really need this turn system.
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 24th Jun 2009 00:06
Ummmm could you give us more information? Do you mean a turn system for 2d or 3d. And even then, what EXACTLY do you need it to do?

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Zeus
17
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 24th Jun 2009 00:18
Okay I am sorry. I need a 2d turn system (the game is in 2d) and I need it to make it where when player one is done using a weapon, then it is player two's turn, then it is player one's turn again, etc. is that good enough? Thank you!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 24th Jun 2009 00:54
Yeah that is good enough. Sorry, I thought you meant a system to turn an image or something, which is pretty complicated.

Here is how I would approach it:

1.Store ALL player data into arrays. This way, they can be referenced with a variable, allowing you to code less and get the same amount done (for example, you could have a playerx(2) array for the x coordinates of each player).

2.Each time the turn changes, change the variable for the number of the player whose turn it is. So for instance,


3.Take the input from the player. I would suggest doing this with either a repeat->until loop or using one similar but building it into your main loop using subroutines, like so:

The benefit to doing it this way is fewer loops in your code (a general rule is the more loops there are, the more problems you will get into trying to get out of them all). Repeat->Untils and While loops are problematic to use a lot because if you forget to reset their conditions, the code is sometimes difficult to debug, until you track down the cause.

4. Determine which command has been decided on and do it. Take care of any house keeping as well (update screen etc).

If I have time I might get back to you with some code, but see what you can do with this for now.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Zeus
17
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 24th Jun 2009 04:29
Okay, how would I use the repeat->until loop?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 24th Jun 2009 04:35
repeat

rem code here

until condition

is the syntax, as for what your code and condition would be i havent read your code thoroughly enough to tell you

There are only 10 kinds of people in the world, those who understand binary and those who dont
Zeus
17
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 24th Jun 2009 04:41 Edited at: 24th Jun 2009 04:41
Quote: "is the syntax, as for what your code and condition would be i havent read your code thoroughly enough to tell you
"


Yeah I meant, why would I use that in my code and how would I use it. Not the syntax. Thanks anyway!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 24th Jun 2009 04:43
To add to smartguys it would be


Make sense?

The repeat until loop works just like it sounds. It will REPEAT everything inside UNTIL a condition is true. I like it because it can be read in english with very little alterations. For instance

Would be read Repeat moving object 10 1 unit until the objects y position is 5.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Zeus
17
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 24th Jun 2009 22:06
Do you think this project would be easier on DBP? I am considering recoding it in DBP, do you think it would be better and easier to do so?

Thanks!
Zeus
Bluestar4
18
Years of Service
User Offline
Joined: 19th Dec 2005
Location: USA
Posted: 24th Jun 2009 22:30
I am curious, do you have a screen shot ?

bluestar4~
---Missle Might - Hero Battles - Zillipede --- which do you like the best ?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 24th Jun 2009 22:33
and no I dont think pro has anything that would make this easier

There are only 10 kinds of people in the world, those who understand binary and those who dont
Zeus
17
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 24th Jun 2009 23:30
Quote: "I am curious, do you have a screen shot ?"


I will provide you all screenshots and a demo in the near future hopefully.


Quote: "and no I dont think pro has anything that would make this easier"


Is the code well written enough? Should I recode it?


Thanks!
Zeus
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 25th Jun 2009 04:39
In this case there would be no difference between the pro code and the classic code. It is all fundamentals really.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Zeus
17
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 25th Jun 2009 04:55
Quote: "In this case there would be no difference between the pro code and the classic code. It is all fundamentals really.
"


Thank you!

Login to post a reply

Server time is: 2024-05-20 10:40:41
Your offset time is: 2024-05-20 10:40:41