1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
stiks02 [169]
3 years ago
15

I have a question about Java Script How do I make gravity working on a game and need to know not in a rush though

Computers and Technology
1 answer:
lisov135 [29]3 years ago
4 0

Answer:

Explanation:

To add this functionality to our component constructor, first add a gravity property, which sets the current gravity. Then add a gravitySpeed property, which increases everytime we update the frame:

Example

function component(width, height, color, x, y, type) {

 this.type = type;

 this.width = width;

 this.height = height;

 this.x = x;

 this.y = y;

 this.speedX = 0;

 this.speedY = 0;

 this.gravity = 0.05;

 this.gravitySpeed = 0;

 this.update = function() {

   ctx = myGameArea.context;

   ctx.fillStyle = color;

   ctx.fillRect(this.x, this.y, this.width, this.height);

 }

 this.newPos = function() {

   this.gravitySpeed += this.gravity;

   this.x += this.speedX;

   this.y += this.speedY + this.gravitySpeed;

 }

}

You might be interested in
Provide a status report to your classmates and instructor. Describe any modifications that you have made to the design or docume
Pavel [41]

Answer:

that's muddled up I can't make out the question

3 0
3 years ago
When data can flow across a cable in both directions, this is known as___Communicating?
Ede4ka [16]

Answer:

full duplex communication.

Explanation:

In a duplex type of topology or communication, data or information can be transferred in both directions.

There are two different types of these communications

3 0
3 years ago
Identify the sampling technique used:A lobbyist for a major airspace firm assigns a number to each legislator and then uses a co
trapecia [35]

Answer:

Random Sampling

Explanation:

Random Sampling technique is being used in the given scenario.

3 0
3 years ago
When an ethernet nic has been configured by os to use half-duplex, the transmit pair of the twisted-pair cable uses?
Maurinko [17]
Simplex, simplex, and half duplex.

Hope this helps!!
8 0
4 years ago
Let PALINDROME_DFA= | M is a DFA, and for all s ∈ L(M), s is a palindrome}. Show that PALINDROME_DFA ∈ P by providing an algorit
denis-greek [22]

Answer:

Which sentence best matches the context of the word reticent as it is used in the following example?

We could talk about anything for hours. However, the moment I brought up dating, he was extremely reticent about his personal life.

Explanation:

Which sentence best matches the context of the word reticent as it is used in the following example?

We could talk about anything for hours. However, the moment I brought up dating, he was extremely reticent about his personal life.

8 0
3 years ago
Other questions:
  • Your network administrator finds a virus in the network software. Fortunately,
    13·1 answer
  • Question 14. (3.04 MC) how does the project manager evaluate the scope of a project
    14·1 answer
  • In the processes tab of task manager, the ____ tab displays the âworking setâ of a process, or the amount of memory it is active
    12·1 answer
  • Discuss advantages and disadvantages of Twisted Pair?
    6·1 answer
  • Write a line of code to convert time to hours. Remember there are 60 minutes in an hour. Then write a line of code to calculate
    9·2 answers
  • What is the value of |-10|
    6·1 answer
  • How many times will line 7 be executed when the following code is run?
    5·1 answer
  • How to beat level 50 in give up robot 2
    5·1 answer
  • Escribe 10 ejemplos de lo que consideras un byte
    5·1 answer
  • Andy works for a TV broadcasting company. He needs to set up a network covering a small area on the work floor. However, he noti
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!