+0  
 
+4
245
6
avatar+429 

So in one of these programs I am working on I am told that 9th level in school will be required and this is a real problem any way what I am trying to figure out is a jump function for persay a stick figure and I am trying to figure out the physics how many varibles would I need I am thinking to like one that represents the jump and gravity  

 

so I have

var = Jump (0);  

and I have 

var = gravity 

 

 

I need to figure out an equation that will stop and translate down on the canvas at an accelerating rate.   

 

 

Assume it is a single dot your designing for. 

 

 

The engine on the site helps process javascript in this so games things more complex like this can be made.

off-topic
 Apr 8, 2019
 #1
avatar+172 
+5

I am not familiar with JavaScript but I may be able to help with my knowlage of C#.

 

Here is how I would solve your problem in C#:

 

float positionX, positionY

float velocityX, velocityY;

float gravity = 0.5f;

 

void Update(float time) {

    positionX += velocityX * time;

    positionY += velocityY * time;

    velocityY += gravity * time;

}

 

void OnJumpKeyPressed() {

    velocityY = -12.0f;

}

 

Hope this helps!

 Apr 9, 2019
 #2
avatar+429 
-4

Intristing I guess with my knoledge I don't understand fully XD I guess I am not looking for how to present it in code but how would I like like an equation how to present that I know how to do it with code but what would it be like job/graavity or somehting like that....

HiylinLink  Apr 9, 2019
 #3
avatar+172 
+4

Hmmm.  So is this some sort of video game your making, or a class your taking or what?

 Apr 9, 2019
 #4
avatar+429 
-4

Well I program on khan so after I make my reusable code I will incorperate a jump function to one varible so I won't hhave to worry about making multiple things move at once so yeah kind of a game...

HiylinLink  Apr 9, 2019
 #5
avatar+172 
+5

https://stackoverflow.com/questions/49413826/how-to-make-a-character-jump-up-with-javascript

JohnyGotchaApples  Apr 9, 2019
 #6
avatar+429 
-3

Unfortunatly I have parental controls and can't visit the link (Truly sorry) I appricate for your time though : )

HiylinLink  Apr 9, 2019

27 Online Users

avatar