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 / for next help, for nights=5 to 20

Author
Message
Daniel wright 2311
User Banned
Posted: 1st Apr 2011 23:48 Edited at: 2nd Apr 2011 00:03
Ok, so I have objects 5 to 20, all the same object assigned to group knights as for nights=5 to 20 next nights. Then I put all my working code into the loop knights {code}next nights, so this means all of the objects should do each command I set for all the objects seperately right? Well, when I come close to one object and his walk animations come to life then he follows me all the other objects also do the same animations to follow the first, but in place. So how do I make them all have the same code, but follow there own animations with in the for next loop, thanks, here is my code.

Edit, to make it more clear If one object is animated they all are animated at the same time.



my signature keeps being erased by a mod So this is my new signature.
kamac
15
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 2nd Apr 2011 00:51
I don't really understand you :x Please, make your question clear, if possible, in one sentence.

pictionaryjr
17
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 2nd Apr 2011 00:55
its because you are using the same variable for every object. make an array holding a variable flag for each object

BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 2nd Apr 2011 00:56 Edited at: 2nd Apr 2011 00:56
That would most likely be because the animations are controlled by the enimyanim1 variable. This variable is the same thing for every knight. You should probably use some kind of an array, maybe with a user-defined type, to allow each one to store a different animation.

EDIT:

pictionaryjr
17
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 2nd Apr 2011 00:57
lol hey. at least great minds think alike

Daniel wright 2311
User Banned
Posted: 2nd Apr 2011 00:57
How? Ive tryed but not shure how to make an array to say object 5 has this animations and object 6 has the same animations but play them sepretly? Please give me an example on how I would declair animations from with in an array.

my signature keeps being erased by a mod So this is my new signature.
Daniel wright 2311
User Banned
Posted: 2nd Apr 2011 01:00
@BMacZero

Ill look into making some sort of user-defined type array But not shure how to in this situation.

my signature keeps being erased by a mod So this is my new signature.
kamac
15
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 2nd Apr 2011 01:01
O, so explaining, that's an array you could use:

Dim enimyanim(1000)
Dim idle(1000)
Dim enemy(1000)

And then this:




into this:




And also this:



Into this




Daniel wright 2311
User Banned
Posted: 2nd Apr 2011 01:05
@kamac

Thanks that helped alot, but Im still stuck on one problem, here it is.

Dim idle(1000)

this is not defining any animation numbers.but I do see how we are seperatin each object into its own.

my signature keeps being erased by a mod So this is my new signature.
Daniel wright 2311
User Banned
Posted: 2nd Apr 2011 01:12
Nerver mind, I figured it out, here is what you are saying



my signature keeps being erased by a mod So this is my new signature.
Daniel wright 2311
User Banned
Posted: 2nd Apr 2011 02:17 Edited at: 2nd Apr 2011 02:23
Well I did all what I was told, And I get a list out of bounds error, then My whole screen dissiapers, here is all im doing.

EDIT, THE TEXT REPORT SAID THIS

Variable 'enemy0' does not exist in program.



my signature keeps being erased by a mod So this is my new signature.
Daniel wright 2311
User Banned
Posted: 2nd Apr 2011 03:23
I figured this all out, the error was in my loop, thanks guys, everything works real good now.

my signature keeps being erased by a mod So this is my new signature.

Login to post a reply

Server time is: 2026-07-11 14:56:23
Your offset time is: 2026-07-11 14:56:23