Download as:
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Language:EN
Pages: 4
Words: 725

Programming II

Assignment 1

Once you are done with your assignment, upload it to eCentennial under Assessments / Assignment / Assignment 1 by the date indicated in the assignment box

Please refer to General Assignment requirements document for the additional requirements

The Direction Enumeration

You will implement the Direction enumeration in Visual Studio

The Sprite Class

This class consist of 10 members as shown below:

Fields:

Properties:

You must use auto-implemented properties.

  1. Name – this auto-implemented property is a string representing the name of the sprite.

Constructor:

Methods:

  1. private bool isCollision(Sprite encounter) – This is a private method that takes an argument of type Sprite. It checks if two sprites, current object and the encounter object are in collision. This method returns true if the objects are in collision and false if they are not. Two sprites are in collision if the distance between their centers is less then the half of the sum of their diameters.

If we have two sprites with coordinates (x1, y1) and (x2, y2) the distance is calculated as: $D = \sqrt{{(x1 - x2)}^{2} + {(y1 - y2)}^{2}}$

Testing

    1. Object named s1 with coordinates (0, 0) and diameter 1 using 2 arguments in the constructor.

    2. Object named s2 with coordinates (1, 1) and diameter 1 using 4 arguments in the constructor.

Console.WriteLine(s3);

s1.Move(Direction.Right);

s1.Move(Direction.Left);

s1.Move(Direction.Up);

s2.Move(Direction.Left);

s1.Move(Direction.Down);

Copyright © 2009-2023 UrgentHomework.com, All right reserved.