ID:168718
![]() Sep 5 2005, 1:37 pm
|
|
i need a pice of code that moves the user from his current position to 5 spaces in his direction and if he bumps any thing it acitvates the attack verb then stops
|
That would work but if the object you bumped is deleted then the player would continue to move in that direction.
/*B-O-F*/ This is untested,but I don't see anything critically wrong with it. |
Please get rid of the brackets ({}). All it does is make the code harder to read. DM doesn't require brackets like C and C++ do. And please use more than 1 space as a tab, as this will make the code also hard to read.
|
He asked to move five spaces though, and if a mob was there, to attack it. But, your code is probably more what he's looking for (though he wont understand it). He's probably looking for an attack Final Fantasy style.
|
Mega fart cannon wrote:
Please get rid of the brackets ({}). All it does is make the code harder to read. Who cares? Its the programmers preference. |
Yes, but when displaying code on the forums, you want it as legible as possible, and not chock full of usr abuse and stuff.
|
I never understood the bracket thing myself, so if I was a person that was recieving that code I wouldn't be at ease with it.
|
Sadly thats not my concern.
Using brackets is a prefrence,I dont do it because I code then go back and add them in; I do it because if I dont then its Hard for me to get a quick grasp of it. Itanium |
Using brackets is a prefrence,I dont do it because I code then go back and add them in; I do it because if I dont then its Hard for me to get a quick grasp of it. Yeah took me awhile to get used to not using them. Though it didn't help that initially the language did require them also :). Just got to remember that when I go and use other languages not to leave hanging ifs :P. |
Yeah DUNG version 2 was the first version that processed scope by indentation rather than braces. The source code to most my games were left with thousands of errors due to inconsistant indentation :P.
|
Anything more than that and I suggest you try learning how to code first. Check out Demos/Tutorials/etc.