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 / placing objects in 2d?

Author
Message
Xenxe
17
Years of Service
User Offline
Joined: 25th Dec 2008
Location:
Posted: 29th Dec 2008 08:14
ok i have been following tutorials and i decided to make my own little project

i want to make a 2d rts style sorta game that is very simple but here is my first problem

when i try to place a barracks the barracks does not stay

now i see what my problem is its the cls i put at the main game loop but if i take that away then the screen will get messy

so here is my code so far i hope one of you can help me make the barracks stay

im going to keep trying

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 29th Dec 2008 14:05
Hello,

There are many ways to handle this. One way is to create a flag variable (a variable whose value changes indicating that something has happened) when the barracks key is pressed. If the flag variable for barracks is set, then gosub your barrackes routine:



Enjoy your day.
Xenxe
17
Years of Service
User Offline
Joined: 25th Dec 2008
Location:
Posted: 29th Dec 2008 14:19
man why didnt i think of that

anyway
awesome this helps alot but now i must figure out how to make multiple barracks..es ill probably be able to do that on my own but some help would be good and this post is probably gonna take a few hours because im not a standard user yet apparently
Xenxe
17
Years of Service
User Offline
Joined: 25th Dec 2008
Location:
Posted: 29th Dec 2008 15:29
ok nevermind that last post (how do you edit?)

anyway now i have a new proble...well a few but the other one is minor

see here it is

i got the multiple barracks like i wanted to i go onto the next thing and that is to make a troops

so i set my troop key arrays and debounces and all that and well i debug and smooth out the errors


well theres the problem
when i press the button to make the troop come out of a random barracks then i dont get a troop

its confusing me and i dont know why

also when i place the second barracks it places the third one at the same time i know that it does that because i was testing it one time and i places the second one while moving upwards and the hird one popped just a few pixels above the second one......any fix for that would be great




i cleanned up my code a bit i hope its readable


Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 6th Jan 2009 16:52 Edited at: 6th Jan 2009 17:06


I was wondering, the variable nn = 0 at this point right? When will nn be greater than 0 because after a quick look I couldn't find it.

Login to post a reply

Server time is: 2026-07-05 01:47:44
Your offset time is: 2026-07-05 01:47:44