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 / object number problem

Author
Message
Jerok
19
Years of Service
User Offline
Joined: 7th May 2005
Location: Mars. Wait a sec I\'m on MARS. OMG
Posted: 11th Oct 2005 03:32
hey im looking for a way to make and fight enemys without having to type the code over and over for each object number :\'(
does anyone know a way to do so?
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 11th Oct 2005 03:39
Yes
for/next sequence...

or a Function.

You should really consider Posting your code...
GMX
19
Years of Service
User Offline
Joined: 19th Sep 2005
Location: In front of my monitor
Posted: 11th Oct 2005 03:42 Edited at: 11th Oct 2005 03:42
I recently asked the same question, here is the answer I got:

Each object is a seperate entity. Therefore the first enemy is object 5 or whatever and the next enemy would be object 6. There's no way to have separate instances of a certain object To make it simpler, use a loop:



Hey, I'm still a newb, so expect lots of questions from me.
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 11th Oct 2005 14:38
That handles the creation at a basic level but for the battle I would create a function, if you don't know what functions are look them up theyre very useful.

Pseudo Code:

DO

FOR I = FirstEnemy TO LastEnemy
Battle(I)
NEXT I

SYNC
LOOP

FUNCTION Battle(Enemy)
Fighting Code
ENDFUNCTION Battle

Using functions is much faster than typing the battle code for each object, the more options you add to the function (Damage, Chance of Hitting, Chance of Critical Hit, etc).

If you don't know what functions are this wont make sense to you so I recommend looking them up, I'd explain them but I have to leave for school soon.


Jerok
19
Years of Service
User Offline
Joined: 7th May 2005
Location: Mars. Wait a sec I\'m on MARS. OMG
Posted: 11th Oct 2005 23:50 Edited at: 11th Oct 2005 23:51
ok ive tried for next statements already and i know how to use functions, but when i try my battle code it says illegal object number or when i go in the game i cant harm the enimies??
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 11th Oct 2005 23:54
Show us your dang code! How can we help you right if we dont know what your doing?
Jerok
19
Years of Service
User Offline
Joined: 7th May 2005
Location: Mars. Wait a sec I\'m on MARS. OMG
Posted: 12th Oct 2005 00:00 Edited at: 12th Oct 2005 00:53
my code:


i know my camera movent sucks but for this purpose it works.
it wont delete the enimies you can pass right thorugh them

edited: globaled t
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 12th Oct 2005 00:40
You need to make t global or pass it into the functions.

Jerok
19
Years of Service
User Offline
Joined: 7th May 2005
Location: Mars. Wait a sec I\'m on MARS. OMG
Posted: 12th Oct 2005 00:50
ok but it still wont delete the enimies for some reason
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 12th Oct 2005 02:24 Edited at: 12th Oct 2005 02:24
Well I am at work so I can't test it. I'll see what I can find when I get home if no one else has fixed it.

[edit] What is your new code?

Jerok
19
Years of Service
User Offline
Joined: 7th May 2005
Location: Mars. Wait a sec I\'m on MARS. OMG
Posted: 12th Oct 2005 04:08
you mean after i globaled t?
i edited the one in the code snippet.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 12th Oct 2005 10:26 Edited at: 12th Oct 2005 10:28
In your char_pos() function you were passing in the same values you were trying to change. It should work like this. There is no need to pass values into that function.

[edited code] You can also remove the enemypos variables from being passed into the kill_enemy() function as you get their values in it.



Jerok
19
Years of Service
User Offline
Joined: 7th May 2005
Location: Mars. Wait a sec I\'m on MARS. OMG
Posted: 12th Oct 2005 16:58 Edited at: 12th Oct 2005 16:58
THANK YOU!!! ive been trying to figure this out for 2-3 weeks and couldnt continue with my game otherwise thank you so much for your help.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 12th Oct 2005 20:37
Glad its working.

Login to post a reply

Server time is: 2024-11-27 16:41:42
Your offset time is: 2024-11-27 16:41:42