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.

Newcomers DBPro Corner / dim guestion

Author
Message
lokatsis
20
Years of Service
User Offline
Joined: 11th Feb 2004
Location: greece
Posted: 31st May 2004 00:18
hi i'm trying to make a game using multiple enemies sprites and because i want to keep my code short i think that dim commands maybe are usefull but i dont know how to use them. maybe someone could give me a simple example or tutorial on how we use the dim commands or arrays to make multiple sprites having the same time common properties (movement,kill sprites that you shoot etc). thanks

THE AOOS
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 31st May 2004 00:50
DIM builds an array.

you can dim a varaible like
DIM sMyVar(9) as String
which gives you 10 string elements with the name sMyVar

or you can dim a user defined type...

Type Person
Name as String
Age as Integer
EndType

Dim oPeople(9) as Person

each of the 10 people would have a name and age property like

oPeople(0).Name="Joe"
oPeople(0).Age=12

oPeople(1).Name="Hector"
oPeople(1).Age=60




* DBP_NETLIB_v1.2 - NOW WITH VARIABLE WATCHER! * Click Logo
Mizipzor
20
Years of Service
User Offline
Joined: 24th May 2004
Location: Sweden
Posted: 31st May 2004 00:57
I tried to make a simple code to show you how arrays worked (not user defined though). But the plan backfired for some reason it only writes in the first element of the array.

Now im stuck as well hehe, yet im not good enough to teach... any REAL darkbasic programmer who can figure this out?



Dreaming of creating a highly advanced AI mind

Login to post a reply

Server time is: 2024-11-26 18:35:57
Your offset time is: 2024-11-26 18:35:57