ID:143200
 
Code:
var
jumping=0
landed=1
verb
Jump()
set hidden=1
usr.icon_state="jump"
var/PreviousDirection=dir
jumping=1
landed=0
step(src,NORTH)
dir=PreviousDirection
sleep(2)
step(src,NORTH)
dir=PreviousDirection
sleep(2)
src.jumping=0
if(src.jumping==0)
var/turf/T=locate(src.x,src.y-1,src.z)
if(T.density==0)
Decend
src.landed=0
step(src,SOUTH)
dir=PreviousDirection
sleep(2)
if(src.landed==0)
goto(Decend)
if(T.density==1)
src.landed=1
src.icon_state="normal"


proc
Gravity()
Start
sleep(1)
var/turf/T=locate(src.x,src.y-1,src.z)
if(T.density==0)
src.landed=0
if(T.density==1)
src.landed=1
if(src.landed==1)
src.icon_state="normal"
goto(Start)
if(src.landed==0)
var/PreviousDirection=dir
src.icon_state="jump"
step(src,SOUTH)
dir=PreviousDirection
sleep(2)
if(src.jumping)
goto(Start)


Problem description:

K the problem is that there are alot of bugs in this code and I would like to know what they are. From what I can see, there shouldn't be anything in here causing a problem. But you guys are the experts and I'm sure that you can find something wrong with my gravity and jump. The main thing that happens is really actually unpredictable. Normally my guy will jump once but will not go to normal when he hits the ground. Then he will not be able to jump as high. But SOMETIMES he will jump onto a higher platform and go back to normal state. Its quite weird and would be a nice thing to fix.

Thanks in advance!
-Moocow

sorry for the double post but some things are spaced out incorrectly. They are correct in my game. Ill just say now that I have no errors on my game atm.
You have to wait 24 hours before you bump your post, but you never listen and keep doing this. If it is something really important then edit your thread and put the information there.
In response to Calus CoRPS
uhhh sorry but this isnt the same thing. This is different. I took all of your guys's advice and devised a code due to what I learned from the demos and what you all said. Now I am having problems because something is wrong so I posted it in "Code Problems" becuase it was a "code problem"
In response to Moocow696
Yeah, but you also bumped the post ((made a reply that didnt need made)) three minutes after making it, rather than editing the original post
In response to Jamesburrow
I don't know what you guys are talking about because I think it has been at least 24 house since I last even replied to my old post. If it hasn't been 24 hours so what?! It now like im watching the time to see if its been 24 hours. ill just make an estimate. All I want to know is what is wrong with my code...is that too much to ask?
In response to Moocow696
You're getting it all wrong. Here's an example, if I made a thread on April 1, 2008 at 7:00am, I must wait 24 hours before I bump THAT post, so on April 2, 2008 at 7:00am I can now bump that post.

[EDIT]
See, it's easy as this to edit a post. Also look at the demo I requested you to read/use a couple of days ago.
In response to Calus CoRPS
sigh...what do you think I did??!!!! sleep? Of course I looked at your demo and 2 others. thats where I got my ideas from. I took what I needed and make the code that was in my first post. So if you or someone else wouldn't mind, I'd like someone to look at my code and tell me whats wrong
In response to Moocow696
Your post was made at 11/21/07 6:08 pm
You then replied to the same post (bumping) at 11/21/07 6:11 pm

Three minutes, not 24 hours, which is the standard on bumping posts. Anything before that, if you have information to be added, you can just edit the original post rather than double-posting.
In response to Jamesburrow
Oh ym gosh! I really don't care anymore. I got all that already. I know I know I know I know I know I know I know I know I know I know! I get it! All I want is my question ansewered....jeeze
In response to Moocow696
First step:
replace the goto's with stuff such as while.
In response to Jamesburrow
is that what's causing all these problems?
In response to Moocow696
Dirty code will always have problems. It's not until it's cleaner when you fully understand if it has problems or not, and where the problems are. As stated before, putting goto where unnecessary makes spaghetti of your code.
In response to Moocow696
Probly not, but as it is, I don't want to read your code. It's sloppy.
In response to Kaiochao2536
well...I know my code is dirty...but could someone who's not too lazy to ready my code just...read my code? Its really not THAT hard to understand what I'm doing there. All I need is to figure out the problem. I need you guys...I really have no where to go from here
byond was not made for 2D so ur prob gonna get issues like this alot lol
In response to Lt. Pain
sigh. i know that. im still trying though. I've been coding games for a little over a year now and I thought it was time I tryed to make a 2D game. So if you guys could just help me out and stop commenting on it...that would be MUCH MUCH MUCH MUCH MUCH VERY appreciated
In response to Lt. Pain
o.O Erm... 2D is exactly what BYOND is made for o.O
mob{

VelocityY = 0;


Stat(){

var/turf/Ground = locate(src.x, src.y - 1, src.z);
if(!Ground.density){
VelocityY--;
if(VelocityY < 0){
src.Move(Ground);
}
} else {
VelocityY = 0;
}


}

}


Try something more like this.
In response to Obs
woah! Now im no expert....but that code is weirder than MY code...and mine's pretty ugly
Page: 1 2