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 / more than 1 thing to same thing

Author
Message
AnalSauceMonkey
21
Years of Service
User Offline
Joined: 24th Oct 2002
Location: I can't find myself
Posted: 19th Nov 2002 05:22
i don't understand how to make more than 1 thing to the same thing without retyping stuff with different variables. can somebody make me a simple 2d game where you can move a shape left and right and shoot as many bullets as you want?
AnalSauceMonkey
21
Years of Service
User Offline
Joined: 24th Oct 2002
Location: I can't find myself
Posted: 19th Nov 2002 05:47
i mean more than 1 thing do the same thing. not to the same thing.
TheCyborg
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Denmark
Posted: 19th Nov 2002 09:51
I'm sorry if I'm the only who does not understand your question!
What is it you really want.

TheCyborg Development.
http://TheCyborg.Amok.dk
The Ultimate Source To DarkBASIC Programming.
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 19th Nov 2002 15:12
for i = 1 to 10
make object cube i,1
next i

this makes 10 of the same cube using a loop statement

indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 19th Nov 2002 15:13
after this kind of concept u probably want to look at types and arrays.

AnalSauceMonkey
21
Years of Service
User Offline
Joined: 24th Oct 2002
Location: I can't find myself
Posted: 19th Nov 2002 23:15
I think it might be arrays, but i don't know how they work. I asked for a 2d game because with 3d there are commands like move object that can make a bunch of objects move using the for command.
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 20th Nov 2002 01:25
imagine an egg carton thats one space wide and 6 units long


dim eggcarton(5)

for i = 0 to 5
eggcarton(i) = i*10
print i
next i
undim eggcarton



each space of the egg carton stores a value 10 times its loop value. i* 10

thats just one dimension u can goto 5,.

AnalSauceMonkey
21
Years of Service
User Offline
Joined: 24th Oct 2002
Location: I can't find myself
Posted: 20th Nov 2002 03:07
sorry, but i still don't get it. can you make the game i requested first, move a shape left and right at the bottom of the screen and shoot as many bullets as you want at nothing.
AnalSauceMonkey
21
Years of Service
User Offline
Joined: 24th Oct 2002
Location: I can't find myself
Posted: 20th Nov 2002 03:10
Whats the difference in:

for i = 0 to 5
i = i*10
print i
next i

and

dim eggcarton(5)
for i = 0 to 5
eggcarton(i) = i*10
print i
next i
undim eggcarton
AnalSauceMonkey
21
Years of Service
User Offline
Joined: 24th Oct 2002
Location: I can't find myself
Posted: 20th Nov 2002 03:12
nevermind. i figured that out, but i still haven't figured out my main question.
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 20th Nov 2002 04:13
arrays can be more than one dimension

u could have eggcarton(10,2)

arrays are global through functions if declared at the top in a global manner devoid of includes etc.



to go onto the next step and talk about TYPES>




DB 1 has psuedo types in DARKEDIT, Guy.S. alternative editor.

it converts them to groups of arrays as DB doesnt have native TYPES.



The best thing to do is to work out exactly on paper how many objects u will actually need.

eg one monster object but also requires 5 bullet objects etc...



then study arrays and TYPES.

Login to post a reply

Server time is: 2024-03-01 05:55:18
Your offset time is: 2024-03-01 05:55:18