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
When you _____ a scroll bar, a shortcut menu appears with commands related to the scroll bar
stich3 [128]
I think d is the right answer
8 0
3 years ago
In what form do the hexadecimal numbers need to be converted for a computer’s digital circuit to process them?
MrMuchimi

Hexadecimal numbers are just a convenient representation of binary data. When entered as text, they consist of ASCII characters 0-9 and a-f. The numbers will then have to be converted to binary. This is accomplished by converting to uppercase, subtracting the ASCII offset (48 for 0-9 or 55 for A-F), so that the result is a number between 0 and 15 (inclusive). This can be stored in computer memory to represent 4 bits.

Hexadecimal numbers represent binary numbers in the following way:

hex | binary

0 = 0000

1 = 0001

2 = 0010

3 = 0011

4 = 0100

5 = 0101

6 = 0110

7 = 0111

8 = 1000

9 = 1001

a = 1010

b = 1011

c = 1100

d = 1101

e = 1110

f = 1111

As you can see, no other 4 bit combination exists.



5 0
4 years ago
Mille gets a text from her friend asking if she wants to come over. It seems like a bit of a hassle to go to her friend's house,
Licemer1 [7]

Answer:

OC. It will be a more positive experience if she spends time with her friend in person.

Explanation:

You should always spend time with people in person rather than online whenever you get the chance.

8 0
2 years ago
Blind spots are those areas not reflected in your:
bulgar [2K]
The answer is C because your sideview and rearview mirrors are there specifically to check behind you, while the vanity mirror is not supposed to be used for the same purpose.
8 0
3 years ago
Read 2 more answers
you need to configure a wireless network using wpa2-enterprise. which of the following components should be part of your design?
Iteru [2.4K]

Answer: AES encryption

802.1x

Explanation:

4 0
2 years ago
Other questions:
  • 3. Which of the following statements is true of a time management plan? 35 POINTS
    9·2 answers
  • Claire is trying to listen to her history professor's lecture, but her mind keeps wandering to thoughts about her plans for the
    5·1 answer
  • Robert gets home from school at 3 p.M. His mom has to leave for her shift at work at 3:15 and she wants him to watch his baby br
    9·1 answer
  • One lap around a standard high-school running track is exactly 0.25 miles. Write the function miles_to_laps() that takes a numbe
    8·1 answer
  • First, read in an input value for variable valCount. Then, read valCount integers from input and output each integer on a newlin
    6·1 answer
  • In the context of computer and network security, _____ means that a system must not allow the disclosing of information by anyon
    10·1 answer
  • Match each of the following terms to its definition: I. web-based II. open source III. project management IV. personal informati
    12·1 answer
  • Jettison folk 2007, Magnum opus, be moving, offers poisoned commentary on the film industry.
    7·1 answer
  • The data source in the document which has the information common to all documents. True or false 
    9·2 answers
  • Why is it important to continiously conduct penetration testing for a strong security system?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!