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
Alex
4 years ago
15

How are XY coordinates utilized in construct ?

Computers and Technology
1 answer:
marshall27 [118]4 years ago
6 0

Answer:

In 2d space we can describe an object's position using 2 values that represent an object's placement on a grid, invisible or not. Typically this is referred to as a 2d coordinate; X and Y. X describes which column the object is in and Y tells what row the object is in. It is pretty much like bingo. A 2d coordinate should look something like these examples: (56,2) or (-1,3). The first number is the X position and tells us how far left or right the position is. The second number is Y and tells us an objects position up and down.

The pixel at the very top left of your screen is always pixel (0,0) - not (1,1). This is because computers always start counting at 0. They think of 0 as being the first position a number can be. This means if your screen is 640 pixels wide, your screen X position will go from 0-639. Any object on screen will have an (x,y) position. and this position can be manipulated by changing these values.

If you subtract from an objects X position it will appear to move left. If you add to it, it will seem as the object is going to the right. Adding to the Y value makes the object go down and subtracting from Y makes it go up.

Just remember: Add to X = right, Subtract from X = left, Add to Y = down, and subtract from Y = Up.

The more you handle (X,Y) coordinates the more second nature this becomes, so don't worry if it seems odd at first.

MOVING AN OBJECT USING VELOCITY

If you simply change an objects position to where you want it to be it will seem as if it is teleporting. Going from (10,10) to (100,100) is a big jump. If you want an object to seem as if it is moving from one place to another then you need to gradually change its position over time. This is an easy process.

In construct 2, a sprite object already has an X and Y position, so all you need to do is create 2 variables, each representing velocity along either the X or Y axis. I normally call them velocityX and velocityY.

Every frame of the game you then add velocity to position. It looks like this below:

notice that I am multiplying velocity by dt. dt stands for Delta Time and tells us how much time has passed since our last frame. Most games will run 60 frames per second, meaning the computer will run the code you made 60 times a second. In this case dt = 0.0166666- or 1/60. Since we want our velocity to be in pixels per second (and not per frame) we multiply velocity by dt. If our velocity was 100 then per frame it would only add 1.6666 to the position of an object. Over the course of a full second the total of the changes will equal 100.

velocity dt frames per second = velocity.

Here is a quick velocity cheat sheet; The velocity of the object is on the left, described using X and Y. The direction the object would be moving as a result is written next to it.

(0,0) - not moving.

(1,0) - moving right.

(-1,0) - moving left.

(0,1) - moving down.

(0,-1) - moving up.

(-1,-1) - moving diagonally up left.

(1,-1) - moving diagonally up right.

(-1,1) - moving diagonally down left.

(1,1) - moving diagonally down right.

Hopefully that wraps it up. Let me know if you have questions.

Introduction to rotation and angles!

You might be interested in
Which of the following is a goal of summarizing? to quote the main idea of what you have read, giving credit to the original sou
Tanya [424]
<span>to review the most important supporting points from the original information I believe is the answer

</span>
7 0
3 years ago
You want to read about Web journals. which keywords would best help you find this information?
ololo11 [35]
The answer is (B) and (D) web or journal, <span>web Not journal


</span> Keyword is part of search engine optimization. Search engine optimization is not that heard. A keyword in a sentence is that significant word used to find info when doing your research.
Always, pick keywords that indicate main concepts of your topic. When searching, connect your keywords with Boolean values like AND, OR, and NOT





6 0
3 years ago
Why is science, mathematics, and technology different from engineering?
oee [108]

Science, mathematics and technology are different because engineering has to do with physical work and you can't get the measuring on a jet or a plane wrong because it could fail in mid air. As for math and science if you fail the test, then you can always re-do it.

3 0
3 years ago
Which of these expressions evaluates to 5.5?
muminat

Answer:

Being assigned the value 10

3 0
3 years ago
Which among the following enhances WS-Security to facilitate a mechanism for issuing, renewing, and validating security tokens?
Aleksandr-060686 [28]

Answer:

a. WS-Trust

Explanation:

WS-Trust can be defined as a WS-specification as well as OASIS standard that help to provides extensions to WS-Security, in order to facilitate a mechanism for issuing, renewing, as well as validating of security tokens which is why the aim and objectives of WS-Trust is to help and enable applications to construct trusted SOAP message exchanges.

Nevertheless WS-Trust enables the issuance as well as the dissemination of credentials within several and various trust domains.

5 0
3 years ago
Other questions:
  • Coretta is thinking about which careers she would enjoy. She considers her personal skills and interests. She enjoys reading and
    13·2 answers
  • If 400 Pa of pressure is applied to an area of 55 m2, which is the resulting force?
    9·2 answers
  • Who found a way of making the steam engine more efficient?
    9·2 answers
  • Which of the following set of instructions defines an algorithm in the formal, strict sense?
    14·1 answer
  • When the print server processes documents waiting in the queue until the print device is available to accept the print job is ca
    14·1 answer
  • What is a Qwerty?<br> A) It's a Computer<br> B) It's a keyboard <br> C) A type of frog
    11·2 answers
  • What component is most likely to be installed in a PC, is considered primary storage, and typically stores the operating system,
    6·1 answer
  • Pls help due tonight<br>Will give brainiest
    13·2 answers
  • Define a function allEqual of type ''a list -&gt; bool that will return true will all element in the input list are all equal, f
    14·1 answer
  • When using the text command, what needs to be around the word or words you<br> want to appear?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!