Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion CMPUT 250 W24 Lab 3/Assets/DVDLogo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
public class DVDLogo : MonoBehaviour
{
//Speed it moves at
public float speed = 3;
public float speed = 5;
SpriteRenderer sprite;

//Bounds of the screen (could get these with camera bounds but we can do this since it's a fixed camera)
public float X_Max = 5, Y_Max = 4;
Expand All @@ -17,6 +18,7 @@ public class DVDLogo : MonoBehaviour
void Start()
{
//Randomly initialize direction
sprite = GetComponentInChildren<SpriteRenderer>();
direction = new Vector3(Random.Range(-1f,1f), Random.Range(-1f,1f));
direction.Normalize();

Expand Down Expand Up @@ -46,17 +48,21 @@ void Update()
//See if a bounce needs to happen before moving
if (newPosition.x>X_Max){
FlipDirectionX();
sprite.color = new Color (0, 1, 0, 1);

}
else if (newPosition.x<-1*X_Max){
FlipDirectionX();
sprite.color = new Color (0, 0, 1, 1);
}

if (newPosition.y>Y_Max){
FlipDirectionY();
sprite.color = new Color (1, 0, 1, 1);
}
else if (newPosition.y<-1*Y_Max){
FlipDirectionY();
sprite.color = new Color (1, 0, 1, 1);
}

transform.position += direction*Time.deltaTime*speed;
Expand Down
11 changes: 6 additions & 5 deletions CMPUT 250 W24 Lab 3/Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ GameObject:
- component: {fileID: 421997421}
- component: {fileID: 421997422}
m_Layer: 0
m_Name: Bouncing Ball
m_Name: Logo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down Expand Up @@ -262,7 +262,7 @@ GameObject:
- component: {fileID: 755472558}
- component: {fileID: 755472559}
m_Layer: 0
m_Name: Circle
m_Name: DVDLogo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand All @@ -277,7 +277,7 @@ Transform:
m_GameObject: {fileID: 755472557}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 421997421}
m_RootOrder: 0
Expand Down Expand Up @@ -321,7 +321,8 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 6e7069a7db07f489a87c0797b3ff2165, type: 3}
m_Sprite: {fileID: 1809748587983926915, guid: 71e3f7df99f9a4e509ccafe48b85b988,
type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
Expand Down Expand Up @@ -566,7 +567,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: This is a bouncing ball
m_Text: It will neber hit the corner.
--- !u!222 &2098954804
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down
Binary file modified CMPUT 250 W24 Lab 3/Library/ArtifactDB
Binary file not shown.
Binary file modified CMPUT 250 W24 Lab 3/Library/ArtifactDB-lock
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading