World Conflicts DOL: The Battle of Passchendaele

Cause and Consequence:

A Field of Mud

As the Soviets on the Eastern Front began to pull out of the war in 1917, Field Marshal Douglas Haig worried that the redeployment of German soldiers on the Western Front would damage the war effort against the German Empire. With his options thinning out, Haig proposed a quick offensive on the Western Front to push the front line from the city of Ypres through the German 4th Army’s defensive position to reach Passchendaele, a small town that was about eight kilometers from a city with a railroad that supplied the German Army. The start of the battle on July 31st was marked by ten days of artillery bombardment against the German positions, doing little damage to the fortifications that had been previously built up. The allies’ infantry attack began soon after. In the south the French First Army, led by François Anthoine, and the British Second Army, led by Hubert Plumer, made strong progress. However, the main force in the north, the British Fifth Army, led by Hubert Gough, made little progress. Throughout the battle, unrelenting rain poured down onto the battlefield, transforming the ground into a muddy swamp and filling in artillery impact craters with water. These conditions caused the battle to slow to a halt, as most movement and advancement attempts were prevented by the horrid conditions. Mud clogged up guns, tanks became stuck, and eventually, some infantry and cavalry units drowned in the ground. The deaths of around 275,000 British soldiers made it clear that without extra help, the battle of Passchendaele and the remainder of the British campaign would result in two losses. After the British, French, Australian and New Zealand troops all failed their assault on the German defensive positions, the Canadian Corps, led by Arthur Currie, were called in October to help salvage the battle and the British campaign. Although Currie initially objected to letting Canadians into the battle due to the likelihood of a large number of lives being lost, he eventually realized that without Canadian help, the British war campaign would die out, meaning a loss for the Allies. When the Canadians finally arrived at the Western Front on October 26th, Currie ordered better roads and improvements to the gun-pits, as well as the transportation of artillery shells to the front line to prepare for an improved infantry attack. On November 10th, 1917, the Allies, with the aid of the Canadian forces captured the village ruins of Passchendaele, ending the battle of Passchendaele, showing the world that Canada was no longer a weak puppet of Britain, but a strong military force independent from Britain’s rule.

 

Historical Perspective:

Image result for ww1 canadian propaganda posters passchendaele

Similarly to the Boer war, which was another war in Canada’s past involving Britain, Canada was divided over whether Canada should continue to support Britain in their military endeavors, specifically the battle of Passchendaele. However, the opinions of many people were less strong than in the conflict over the Boer war. The British people wanted the Canadian Corps to be sent over to support Britain against the German defenses, while some others argued the same point; young Canadian men should not be dying in Europe for someone else’s war. However, the Canadians directly involved with the war effort viewed the battle as a noble cause, and realized that it was in Canada’s overall best interest to help the Allies stop the Central powers. Despite this, many, such as Arthur Currie, were reluctant to go into the battle, due to the conditions and the outlook of the battle so far. However, after the Canadian Corps helped out the Allies in securing Passchendaele, the general public of Canada saw the decision to send the Canadian Corps in as a great idea, and boosted the morale of the country, as well as the outlook of the war.

Continuity and Change:

After news of Canada’s Army returned from Europe regarding the battle of Passchendaele, the change in views of Canada as a military force had changed dramatically. It had been a widely known fact that the Canadian Corps being sent into the battle of Passchendaele were a very small group compared to the British and German Armies, but when the Canadian troops arrived, they tipped the scales in the allies favor, allowing them to reach their goal of capturing Passchendaele. When Canadians heard about this, the country’s morale was boosted, changing the way that Canadians thought about their military strength. Compared to outlook on Canada as a military power during the naval issue that occurred during Laurier’s time as Prime Minister, the country’s reaction after the battle of Passchendaele, the view that Canada was militarily weak was replaced by pride for the Canadian soldiers that completely changed the outcome of a battle.

Historical Significance:

The battle of Passchendaele solidified Canada as more politically autonomous, as Britain did not force them into battle like a pawn, and Canada also made the biggest difference when they joined the battle. Months of hard-fought battles had worn down the British in the battle of Passchendaele, and with the British campaign morale running low, Britain was in no condition to bark orders at Canada. Instead, Britain and Canada were now at an equal level, rather than an empire and a push-able colony. Instead of forcing Canada into helping them with the battle, Canada was persuaded to help, but could have broken away and ignored the war. However, Canada chose to help out with the war effort, as it was in their best interest to support the Allies. This led to the deployment of the Canadian Corps onto the battlefield, which drastically changed the tide of battle. Arthur Currie, though he had just recently showed up to the battlefield, was allowed full control over most of the processes and preparations that went on before the infantry attack, showing us that Canada was given some political power to call the shots independently. In addition, the Canadian Corps, although lower in numbers, helped the allies claim more land and led the final push to the ruins of Passchendaele. This showed the world that Canada had not only become politically independent from Britain, but also become a strong nation without much help, and was now fully autonomous over it’s own decisions. This also affirmed the beliefs of Robert Borden, Canada’s Prime Minister during the world war one, that the battle of Passchendaele was proof that Canada had reached independent nationhood. Moreover, Canada’s participation in the battle of Passchendaele made them socially autonomous as well. While the British campaign was beginning to fail, and the British morale began to drop, Canada’s morale was high despite the state of the battle. As soon as Canadian troops came to relieve the British and Australian troops, the morale was boosted, showing that instead of Canada following Britain’s social climate, it had it’s own, and was independent enough to give back to Britain.

Independent Novel Study Speech: An Astronaut’s Guide to Life on Earth

On July 20th, 1969, the first astronauts touched down on the moon, changing the distant, unknowable orb in the sky into one of humanity’s greatest achievements. The historic moon landing inspired many people, including a young Canadian boy from a small town, who then set their sights on the stars. An Astronaut’s Guide to Life on Earth is an autobiography by Chris Hadfield about the path to becoming an astronaut, outlining the struggles and successes of his journey. By reading Hadfield’s story, we come to realize that a core value that defines Canadian Identity is to face the adversities that block us from our goals.

Chris Hadfield was born on August 29th, 1959 in Sarnia where he grew up on a corn farm with his siblings. After watching the moon landing, he became determined to become an astronaut, aware that if Canada had a space agency, his odds would still be impossibly small. Chris returned to school from his summer break, reinvigorated with his aspirations, realizing that even the small decisions he made now mattered in the future. As he grew, he was thrown into enrichment programs, learning to think “more critically and analytically, to question rather than to simply get the right answers” (4). His high education, partnered with his values in hard work, carried him past the challenges he faced and straight into Air Cadets, a pre-requisite for becoming an astronaut.

At the time, the Canadian Government had not started up a new space agency, but Chris still pursued his goal. Now 19, Hadfield learned how to fly planes and enrolled in a military college, since the “route to NASA was via the military” (6). A few years later after graduating from the college, Chris got married, still persisting towards his goal. He moved with his family from Ontario to Saskatchewan, beginning jet training with the Canadian Army. However, moving was hard; a recession hung the threat of bankruptcy over their heads. Although flying planes was a step along the path to Chris’ final goal, he saw it as a learning opportunity and persisted through the toughest of times. However, knowing that his chances were still improbable, he made sure to avoid hanging all his self worth on his dream, but still pursued it for the ‘just in case’ scenario.

The year was 1983, and luckily for Chris, his chances for fulfilling his life-long dream went from nothing, to a glimmer of hope at the end of the tunnel; Canada had opened the Canadian Space Agency and selected it’s first six astronauts. Chris kept flying fighter jets for the military but began to worry about his road taken. The first astronauts chosen by the CSA were all scientists, not pilots. He had already committed to the traditional American path to becoming an astronaut, and there was no going back. Thinking into the future, Chris decided to complete a master’s degree in aviation systems at the University of Tennessee, just in case the CSA began to hire again.

The CSA posted an ad in the newspaper: Astronauts Wanted. Chris scrambled to assemble a resume; his chance at a life-long dream had dropped from unlikely to a 1 in 5329 chance. Five months after submitting, 1 in 500. Then 1 in 100. 1 in 50. 20. 10. After an intense selection process and months of radio silence, Chris received a call from the CSA, asking if he wanted to be an astronaut.

By reading Chris Hadfield’s An Astronaut’s Guide to Life on Earth, we learn about the life of a boy with a dream who tells us that as Canadians, we can persist and face our challenges to achieve our goals. With hard-work and perseverance, Chris Hadfield showed the world that the 9-year-old boy who stared into the sky on that fateful night was not just a dreamer, but a dreamer with an iron will.

Socials Blog Post: John A. Macdonald

Dylan Poon

Mr. Morris

May 7, 2019

John A. Macdonald: A Shameful Disgrace

Statues of historical figures should commemorate eminent people and represent our role models, exemplifying the positive aspects of our collective history. Recently, in a time of indigenous reconciliation, people began to reconsider the need for outdated historical figures represented in the public sphere. Over the past two years, a debate started regarding the inclusion of John A. Macdonald’s memorialization in statues, schools, and other public institutions. While some claim that Macdonald’s actions against minorities in Canada merit an erasure, others believe that “it’s important that we recognize our history – the good and bad” (McKenna). Despite the many great accomplishments Macdonald has done for our country, John A. Macdonald’s name and likeness should be removed from the public sphere, due to his racial insensitivity towards Canada’s First Nations people, and the presence of insensitive values that no longer reflect our own.

John A. Macdonald’s wrongdoings against indigenous minorities in Canada is inexcusable. His insensitivity towards the indigenous people show a perfect example of who he truly is. Before Macdonald ever set foot into Canada, European settlers who traveled to North America in the 1600’s created a treaty with the First Nations people called the Two Row Wampum; a peace treaty that signaled “hope for peaceful coexistence and [spoke] of a river journey where settlers and Indigenous peoples [traveled] side by side, accepting each other’s history and laws” (Farber). However, Macdonald completely ignored the existence of this treaty, engaging in “crimes against humanity, if not outright genocide” (Farber). Macdonald and his government used starvation to drive the First Nation’s people of the prairies into reserves and brought upon thousands of disease-related deaths, calling his policies and actions “ethnic cleansing” (Daschuk). In addition to this, Macdonald implemented residential schools in Canada. Residential schools were schools that forcibly removed First Nations children from their families and culture, and imposed western ideals onto them, attempting to erase their culture by forbidding them from acknowledging their heritage. Many children who were forced into residential schools were also abused and sometimes sexually assaulted. This caused disruptions in the traditions of the First Nations people, as not only were oral traditions silenced, but children were being taken from their culture, making it difficult to pass down traditions. Due to the lack of respect Macdonald showed towards indigenous people, we should be apologizing for the horrible acts committed against the First Nations peoples by removing Macdonald from the public sphere.

Contrary to this, those who agree with keeping Macdonald in the public sphere might argue that even though Macdonald’s views are not acceptable in our times, many people shared the same views at the time. Though this is true, Macdonald’s views stand out against those of the same time period. He was the only politician to ever refer to Canadians as an ‘Aryan Race’, and additionally referred to Chinese people as mongrels and First Nations as savages. In the 1870s Macdonald placed a rule that stated that “No Chinaman or Indian” people could vote, despite British Columbia’s population being made up of mostly Chinese immigrants and First Nations people (Macdonald). In addition, the racism considered normal in the 1800’s is not acceptable in our time, no matter how extreme the view, since our society has changed to become more sensitive. Keeping John A. Macdonald’s statues up means that we still somehow agree with the values that Macdonald held, even though they are severely outdated. By taking down the statues and names that honor Macdonald, we are acknowledging that we have moved forwards from a time where racism and white supremacism was common, and that we do not support John A. Macdonald’s perspective on races.

With the debate continuing as strongly as ever, people are split about whether our first Prime Minister should be honored or taken out of the public sphere. Due to Macdonald’s irreversible actions against the First Nations people, and his extreme lack of respect for non-white populations, John A. Macdonald deserves to have his statues and names removed out of respect for the indigenous peoples. Since we should not erase him from history due to educational purposes, it is still reasonable to be “honest and [tell] the truth” in textbooks and museums (Bellegarde). Therefore, we should remove the statues from the public, but display them in an unbiased, educational light. John A. Macdonald may have been a nation-builder and our first Prime Minister but his record of racism and genocide makes him unfit for memorialization.

 

Citations:

The Residential School System. (n.d.). Retrieved May 9, 2019, from https://indigenousfoundations.arts.ubc.ca/the_residential_school_system/

Dangerfield, K. (2018, September 06). Majority of Canadians say statues of John A. Macdonald should stay put: Survey. Retrieved May 9, 2019, from https://globalnews.ca/news/4430598/sir-john-a-macdonald-statue-removal-survey/

In debate over first PM’s legacy, vast majority say John A. Macdonald’s name, image should stay in public view. (2018, October 12). Retrieved May 9, 2019, from http://angusreid.org/macdonald-reconciliation/

Rabson, M. (2018, August 17). ‘You can’t erase history’: McKenna weighs in on removal of statues like Sir John A. Macdonald. Retrieved May 9, 2019, from https://globalnews.ca/news/4389453/catherine-mckenna-sir-john-a-macdonald-statue-removal/

Farber, B. M., MacDonald, D. B., & Dan, M. (2018, August 21). Should statues of Sir John A. Macdonald be removed? Yes. Retrieved May 9, 2019, from https://www.thestar.com/opinion/contributors/thebigdebate/2018/08/21/should-statues-of-sir-john-a-macdonald-be-removed-yes.html

Ballingall, A. (2017, August 24). Sir John A. Macdonald: Architect of genocide or Canada’s founding father? Retrieved May 9, 2019, from https://www.thestar.com/news/gta/2017/08/24/john-a-macdonald-schools-should-be-renamed-elementary-teachers-union.html

 

In-Depth Blog Post #6: The Final Post

The end of the In-Depth Project is beginning to draw near, and as I begin to look back on my progress, I can confidently say that I have come a long way since the start of the project. Over the last few weeks, I have been working on one project that combines just about everything I have learned so far into one big amalgamation of code, otherwise known as a much more complex game. In total, it took me about 48 hours of coding, and 3 mentor meetings to ask for help and hints.


Status Update:


Tappy Defender:

The final project I have worked on is Tappy Defender. Using assets given to me by my mentor, I had to piece together a game based on the sample end product my mentor had given me. Since this project was so much harder, requiring me to utilize every tool in my skill set, my mentor also had to step in here and there to guide me towards the final product.

Here is a list of everything I had to use from my previous projects:

My First App: Putting stuff on the screen

Movement Testing: Making stuff move

Animated Movement Testing: Animations and landscape screen orientation

Snake Game: Reaction to player inputs and dividing the screen into buttons

Parallax Scrolling: Layering and parallax

Heading and Rotation: Displaying variables on screen

Scrolling Space Shooter: Setting boundaries

Space Invaders: Making collision checks

Breakout: Edit code and debug programs

The hardest and final project has been finished, after a ton of effort. Until In-Depth night, I will be working on furthering my understanding, and looking into some of the roadblocks I have faced while making this project.


How to Have a Beautiful Mind:


Concepts In My Mentor Meetings:

During all of my mentor meetings, the main concept that I had been trying to learn was coding, through the use of practical projects, which taught me the concept. Additionally, the way that coding is structured requires there to be a collection on concepts that come together to make the concept of coding, such as placing objects on the screen, moving objects, interacting with objects through the screen and many others.

Alternatives:

In the past few meetings specifically, I have been offered many more alternatives, since I have moved into a slightly more autonomous style of completing my final project. My mentor has told me that as long as the code works and completes it’s role, there is not one set way to do it, meaning that I am free to an almost endless amount of alternatives. For example, when I was trying to implement the background into the app, I used a different way than what my mentor had expected. However, since it worked, he was fine with this. Another alternative I was given was the way I would learn the coding. My mentor asked me if I wanted to go through each project slowly together, or have him introduce each project and then let me go and puzzle through the project and ask for help when I needed it. Since I chose to go through on my own, I feel that I have gained a whole lot more than if I had slowly gone through each project with my mentor. Another mentor might have offered me something more structured and formal, introducing everything I needed to know before even starting, such as how to set variables, how to create inputs, how to make objects move, and how to debug. Though it would have given me an early payoff in having an immediate understanding, I would not have gained as much from learning strict rules and applications.


Learning Center:


My goal with my learning center is to be able to explain how I learned to code, as well as explain how the code works in a basic format. With my learning center, I plan to explain what I have done and how the code works up front and center, using my phone with all the apps I have made as a centerpiece. I will also have my computer readily available with all the code that I want to showcase. Using a tri-fold, I will also showcase the process that each app goes through to become more refined. To make an engaging and interactive experience, I will mark off areas of my code that can have variables changed, and in real time, show the differences in the apps once the changes are made. The people visiting my learning center will have the chance to firstly learn how the code is all put together, then see the differences made when variables are changed and finally, be able to try out the apps I have made.


That’s all for my In-Depth Posts. I am looking forward to In-Depth Night!

 

Socials Blog Post: An Astronaut’s Guide to Life on Earth

Reading through Chris Hadfield’s An Astronaut’s Guide to Life on Earth has sparked some interest in the concepts being discussed in the novel. Here are five passages that I have enjoyed the most so far.

Quote #1:

“I also knew, as did every kid in Canada, that it was impossible. Astronauts were American. NASA only accepted applications from U.S. citizens, and Canada didn’t even have a space agency. But … just the day before, it had been impossible to walk on the Moon.” (3)

At some point when everyone was young, they probably had the dream of becoming an astronaut. The thing that is interesting about this quote however, is that Chris Hadfield’s dream did come true, despite everything working against his favor. As someone who has had an intense interest in space exploration as well as becoming an astronaut, I find it inspiring how Chris managed to overcome not only the odds, such as NASA only hiring Canadians, but additionally, pursuing the dream that most people drop due to the seemingly impossible odds. Furthermore, seeing how much astronaut hiring has evolved over the years from an exclusive job for the lucky to a more widespread job requiring training, hard work and determination is inspiring, and has likely caused more youth nowadays to understand the value of persistence.

This quote shows us that around the time of the moon landing up until recently, Canada has simply been seen as a lesser version of America. The fact that Canada and America were seen as almost the same thing, except that Americans had more opportunity, is seen evidently, when Chris Hadfield as a child knows that he cannot reach his dream of becoming an astronaut since he is a Canadian. This reveals that Canadians valued being ‘American’, wanting the same things, but knowing that they could never have them. Recently, Canada has been trying to come out from America’s shadow, and the values have shifted towards being ‘not American’, meaning that Canada is trying to establish themselves as an independent nation.

Quote #2:

“An astronaut is someone who’s able to make good decisions quickly, with incomplete information, when the consequences really matter. I didn’t miraculously become one either, after eight days in space.” (28)

As mentioned earlier, I had the dream to become an astronaut as a child, so reading this quote reveals to me a lot about the kind of skills needed to become an astronaut. I personally identify with this quote as well, since I am trying to learn how to make good decisions through experiential learning. On the recent kayaking trip, I believe I improved my decision making skills, as well as had the determination to keep going in the face of a problem when the wind and weather prevented us from going to our camping spot safely. In addition, I found that I have a strong point in determination, and seeing how far Chris Hadfield was able to go with a willingness to learn and some perseverance is extremely motivating to me.

To me, a core value that defines Canadians has been determination to meet goals and show growth. Chris Hadfield had that determination to follow his goals no matter what, even though the odds seemed impossible. By doing everything that Chris thought an astronaut would do, he was able to prepare himself to step up and become the person he is today. This showed growth, just as Canada has shown throughout it’s history. When Canada was a collection of separated colonies, they all had the same goal; to survive against the newly independent American colonists. To move towards that goal, the colonies decided to confederate and grow to rise up to the challenge, similarly to Hadfield and his challenge.

Quote #3:

“Helping to install Canadarm2 and playing a part in building this permanent human habitat off our planet – which is all the more remarkable because it has required the participation and cooperation of 15 nations – made me feel like a contributing, competent astronaut.” (33)

I found this quote relevant and interesting, since it gave some more insight into how it feels to be an astronaut. As a kid, I had always wondered what being in space physically felt like, but never considered the emotions that would come with being an astronaut, especially one that would have to stay in a space station for months on end. Reading this book, I have gained much more insight into what emotions and thoughts would be floating around inside the head of an astronaut. In addition,  chapter the quote is in is about how astronauts think differently than everyone else, and seeing how I could change my own thinking to become more constructive is inspiring.

This quote reveals that even back when this space mission was taking place, Canada wanted to be known as a collaborative and helpful nation. This is proven by the existence of the Canadarm and Canadarm2, which are physical evidence of the hard work and dedication to international space missions that Canada has. It also shows how Canadians, though multicultural, still have a shared patriotic value, shown when Chris is picked to install the Canadarm2 as a Canadian astronaut. In recent events, Canada has been trying to prove itself even more in international projects such as the Lunar Gateway Program, which is a NASA led project to send a station to orbit the moon.

Quote #4:

“No one wants to go to space with a jerk. But at some point, you just have to accept the people in your crew […]” (102)

Personally, this quote reminded me of entering the TALONS program, but more so entering MACC for my first ever ‘gifted class’. When going into MACC, I knew few people, and tried to stick to the people that I knew from my elementary. However, I realized after a while that it would be better for me to get to know more people, and come out of my shell a bit more. When entering TALONS, I knew that I had to consider this again, but foolishly, still stuck with the people I knew from MACC. Reading this quote, I realize that I could have had more of the positive interactions I have with my peers now earlier in the two years I have spent in TALONS.

This quote also reflects a main part of Canadian identity. Canada is known to be a multicultural nation, and embraces the fact that it is a welcoming place. Drawing parallels between going to space and living in Canada is quite easy. In Canada, we have all learned to accept one another, and share a common value in having a lot of diverse ethnic groups. As an immigrant country, we have no choice in the people that live here with us, but understand and accept that our diversity makes us unique. Similarly, going to space requires that the astronauts understand and accept one another, and be open to working cooperatively with people that they do not know.

Quote #5:

 

 

Theme:

Early success can often lead to failure in tough situations.

As stated again and again in this book, Chris Hadfield had to work to get to where he is. In his youth, he did not experience much success, but rather learned how to learn. When he crashed a tractor into a metal bar, his father made him learn how to weld it back together to make it known that “things are never as bad or as good as they seem at the time” (10). By teaching Chris that he needed to learn from his failures, Chris was ready to face challenges in astronaut training, where “even the most gifted person in the world will, at some point during astronaut training, cross a threshold where it’s no longer possible to wing it” (100). In conclusion, early success is “essentially being rewarded for a lack of preparation” (100).

In-Depth Blog Post #5: Understanding

With so much time since the last post, I have a lot of new progress to share in this post. Over spring break, I spent some time practicing coding, and learned how to clean up my code and change variables within code to change things when the app runs. I have also raised the difficultly significantly, and the projects are starting to take more time.


 

Status Update:


 

Scrolling Shooter:

This was the main project, that took me a long time to complete. Using the triangle turning and moving code from the last post, I added buttons to press, some stars in the background (with parallax)!, a projectile and some obstacles to make a space shooting game. There is not a goal to win yet, but I learned how to create game boundaries, make parallax like effects in more than one direction, and how to code collision checks.

 

Social Studies DOL #1: Is Canada a Post-National State?

Based on my previous opinions, as well as some additional research, I personally believe that Canada is becoming, but currently is not, post-national state. Firstly, it is currently not a post-national state as each culture within Canada has not thrown aside their own values or identities “in favor of an inclusive citizenship based on simple acknowledgment of shared humanity.” (McCullough 2017) This means that Canada does not currently meet the requirements to be a post-national state, but is on the way to becoming one. Since there has not been any enforced mainstream by the majority population, and immigrants are able to come to Canada without needing to worry about changing anything about themselves to be accepted, Canada could very well become a post-national state. This is evident when Trudeau said that “there is no core identity, no mainstream in Canada.” This means that none of the majority populations have pushed their own identities as Canadians upon the minorities out of respect for their cultures, but at the same time still keep contact with their own. (Trudeau 2015) This leads me to believe that Canadian nationalism is not based on race, ethnicity or language, but is to hold on to our own individual nationalism, while sharing patriotism in the form of “a love of country and commitment to our heritage and shared values” instead of adopting a sense of nationalism. (Malcolm 2019) Without this patriotism, the diversity in our country would hold us from performing as a cohesive whole, and place us in Hobbes like state of nature, where there is no sense of respect for other cultures. With evidence that prevents Canada from being a post-national state, it is hard to prove, but as line between cultures blur and appreciate each other under the reason of enjoying living in Canada, our country may soon become a post-national state.

Sources:

https://en.wikipedia.org/wiki/Postnationalism

https://www.washingtonpost.com/news/global-opinions/wp/2017/06/29/who-gets-to-decide-canadas-identity/?noredirect=on&utm_term=.0be59d05de36

https://www.theguardian.com/world/2017/jan/04/the-canada-experiment-is-this-the-worlds-first-postnational-country

http://www.vancouversun.com/opinion/columnists/douglas+todd+dangers+postnational+canada/11779069/story.html

MALCOLM: Raced-based politics natural outcome of Trudeau’s ‘postnational state’

In-Depth Blog Post #4: Hard Work and Determination

In the last three weeks, I have been working very hard on improving how fast I can code, as well as how accurately. I have two projects to showcase, with the third being a much more complex project that combines everything I have learned so far. Though still being simple in appearance, the two I have right now are harder than earlier. Again, my screen recorder keeps crashing, and I have somewhat given up using it. For this week I will be going over the progress I have made since last post.


Status Update:


 

Parallax Scrolling:

Last week, I had made a game that was fun, but was not interesting enough in the graphics department. So this week, I decided to go back to some basics and learn how to make a background for games. This project in particular applies to the types of games I will be making in the future, as adding in moving backgrounds that follow the player’s movement will make the aesthetics of the games much more appealing.

Essentially, the code loops an image, for example, the buildings in the background, and moves the image across the screen repeatedly. However, the rate of movement can vary, and by making “closer” images move faster, this can give the illusion of far and near objects.

Code at the bottom of the post.


 

Movement with Rotation:

This app was harder than all the others that I have made, and uses a lot of trigonometry to function correctly. It took me about an hour to configure and edit some numbers to make the app work properly. It also taught me how to make buttons. Though not visible in this app, the bottom 1/8 of the screen is split off from the top, controlling the turn, and the top part move the triangle in the direction it is pointing. In the next project I plan to do, I am incorporating the turning mechanic, movement, the parallax scrolling, and a shooting mechanic.

Code at the bottom of the post.


 

How to Have a Beautiful Mind:


 

Conversation:

Randy: So, lets try that app again. Hopefully it works this time.

Me: Yeah I hope so.

*app doesn’t work*

Me: Ooh, that’s not what we intended.

Randy: Alright, go through your code, and make sure that everything is in the right place

Me: (Nods) Ok… everything is there and it is all in the right place

Randy: Check spelling

Me: Oh, I found it. Can I run the app again?

Randy: Sure.

*App loads*

Me: So what else can I do to troubleshoot an error?

Randy: Well, you should first of all always check those two things first.

Me: Alright

Randy: If it still won’t work, just do the normal things you would do to fix an unresponsive program

Me: What do you mean by that? Is it like, when a program says it is ‘not responding’?

Randy: Exactly that, so you would close it and reopen it, open a windows troubleshooter, things like that.

How to be a good listener:

While running my apps, I made sure to also pay attention to any inputs that my mentor might have for me, and nod when I understood something he said. In addition, when he updated me on his progress on his own personal project, I made sure to listen to what he was saying, as it might help me.

How to ask questions:

When Randy talked to me about how to troubleshoot my apps, he mentioned a couple ambiguous things that I was not fully aware of, so I asked for elaboration, which has actually saved me some time when my internet browser needed troubleshooting earlier this week.


~ My project is going along very well, see you next time!


Code:


Parallax:

Background.java
package com.dpoon.parallaxscrolling;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;

public class Background {
    Bitmap bitmap;
    Bitmap bitmapReversed;

    int width;
    int height;
    boolean reversedFirst;
    float speed;

    int xClip;
    int startY;
    int endY;

    Background(Context context, int screenWidth, int screenHeight,
               String bitmapName, int sY, int eY, float s){
        int resID = context.getResources().getIdentifier(bitmapName,   // Make a resource id out of file name
                "drawable", context.getPackageName());
        bitmap = BitmapFactory.decodeResource(context.getResources(), resID);     // Load the bitmap using id
        reversedFirst = false;  // Which version of background (reversed or regular) is drawn first (on left)

        //Initialise animation variables.

        xClip = 0;                                  // Where to clip the bitmaps. Starting at the first pixel

        startY = sY * (screenHeight / 100);                              //Position the background vertically
        endY = eY * (screenHeight / 100);
        speed = s;

        bitmap = Bitmap.createScaledBitmap(bitmap, screenWidth, (endY - startY), true);  // Create the bitmap

        width = bitmap.getWidth();                                 // Save the width and height for later use
        height = bitmap.getHeight();

        Matrix matrix = new Matrix();             //Create a mirror image of the background (horizontal flip)
        matrix.setScale(-1, 1);
        bitmapReversed = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
    }
    public void update(long fps){
        xClip -= speed/fps;                            // Move the clipping position and reverse if necessary
        if (xClip >= width) {
            xClip = 0;
            reversedFirst = !reversedFirst;
        } else if (xClip <= 0) {
            xClip = width;
            reversedFirst = !reversedFirst;
        }

    }
}
MainActivity.java
package com.dpoon.parallaxscrolling;

import android.app.Activity;
import android.graphics.Point;
import android.os.Bundle;
import android.view.Display;

public class MainActivity extends Activity {
    private ParallaxView parallaxView;                                   // Our object to handle the View

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Display display = getWindowManager().getDefaultDisplay();                     // Get Display object
        Point resolution = new Point();                          // Load the resolution into a Point object
        display.getSize(resolution);
        parallaxView = new ParallaxView(this, resolution.x, resolution.y);                  // set the view
        setContentView(parallaxView);                    // Make our parallaxView the view for the Activity
    }

    @Override
    protected void onPause() {                 // If the Activity is paused make sure to pause our thread
        super.onPause();
        parallaxView.pause();
    }

    @Override
    protected void onResume() {              // If the Activity is resumed make sure to resume our thread
        super.onResume();
        parallaxView.resume();
    }
}

ParallaxView.java
package com.dpoon.parallaxscrolling;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import java.util.ArrayList;

public class ParallaxView extends SurfaceView implements Runnable {
    ArrayList<Background> backgrounds;

    private volatile boolean running;
    private Thread gameThread = null;
    private Paint paint;                                                                   // For drawing
    private Canvas canvas;
    private SurfaceHolder ourHolder;

    Context context;                                                 // Holds a reference to the Activity
    long fps =60;                                                                      // Control the fps
    int screenWidth;                                                                 // Screen resolution
    int screenHeight;

    ParallaxView(Context context, int screenWidth, int screenHeight) {
        super(context);

        this.context = context;
        this.screenWidth = screenWidth;
        this.screenHeight = screenHeight;

        ourHolder = getHolder();                                          // Initialize our drawing objects
        paint = new Paint();

        backgrounds = new ArrayList<>();                                         // Initialize our array list

        //load the background data into the Background objects and place them in our GameObject arraylist
        backgrounds.add(new Background(this.context, screenWidth, screenHeight, "skyline", 0, 80, 200));
        backgrounds.add(new Background(this.context, screenWidth, screenHeight, "grass", 70, 110, 800
        ));

        // Add more backgrounds here

    }

    @Override
    public void run() {
        while (running) {
            long startFrameTime = System.currentTimeMillis();
            update();
            draw();

            long timeThisFrame = System.currentTimeMillis() - startFrameTime;            // Calculate the fps
            if (timeThisFrame >= 1) {
                fps = 1000 / timeThisFrame;
            }
        }
    }

    private void update() {                                        // Update all the background positions
        for (Background bg : backgrounds) {bg.update(fps);}
    }

    private void drawBackground(int position) {
        Background bg = backgrounds.get(position);                  // Make a copy of the relevant background

        // define what portion of images to capture and what coordinates of screen to draw them at

        Rect fromRect1 = new Rect(0, 0, bg.width - bg.xClip, bg.height);            // For the regular bitmap
        Rect toRect1 = new Rect(bg.xClip, bg.startY, bg.width, bg.endY);


        Rect fromRect2 = new Rect(bg.width - bg.xClip, 0, bg.width, bg.height); //For the reversed background
        Rect toRect2 = new Rect(0, bg.startY, bg.xClip, bg.endY);


        if (!bg.reversedFirst) {                                            //draw the two background bitmaps
            canvas.drawBitmap(bg.bitmap, fromRect1, toRect1, paint);
            canvas.drawBitmap(bg.bitmapReversed, fromRect2, toRect2, paint);
        } else {
            canvas.drawBitmap(bg.bitmap, fromRect2, toRect2, paint);
            canvas.drawBitmap(bg.bitmapReversed, fromRect1, toRect1, paint);
        }
    }

    private void draw() {
        if (ourHolder.getSurface().isValid()) {
            canvas = ourHolder.lockCanvas();         //First we lock the area of memory we will be drawing to
            canvas.drawColor(Color.argb(255, 0, 3, 70));                            //draw a background color

            drawBackground(0);                                          // Draw the background parallax

            paint.setTextSize(60);                                               // Draw the rest of the game
            paint.setColor(Color.argb(255, 255, 255, 255));
            canvas.drawText("I am a plane", 350, screenHeight / 100 * 5, paint);
            paint.setTextSize(220);
            canvas.drawText("I'm a train", 50, screenHeight / 100*80, paint);

            drawBackground(1);                                                                                                   // Draw the foreground parallax

            ourHolder.unlockCanvasAndPost(canvas);                               // Unlock and draw the scene
        }
    }

    public void pause() {                                   // Clean up our thread if the game is stopped
        running = false;
        try {
            gameThread.join();
        } catch (InterruptedException e) {
            // Error
        }
    }

    public void resume() {           // Make a new thread and start it. Execution moves to our run method
        running = true;
        gameThread = new Thread(this);
        gameThread.start();
    }
}                                                                                // End of ParallaxView

Movement and Rotation:
MainActivity.java
package com.dpoon.headingandrotation;

import android.app.Activity;
import android.graphics.Point;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Display;

public class MainActivity extends Activity {

    // view will be the view of the game. It will also hold the logic of the game
    // and respond to screen touches as well

    HeadingAndRotationView view;

    @Override
    protected void onCreate(Bundle savedInstanceState) {      // This is the entry point to the game.
        super.onCreate(savedInstanceState);

        Display display = getWindowManager().getDefaultDisplay();              // Get a Display object
        Point size = new Point();                  // Load the resolution into a Point object
        display.getSize(size);
        view = new HeadingAndRotationView(this, size.x, size.y); // Initialize gameView and set it as view
        setContentView(view);
    }

    @Override
    protected void onResume() {                 // This method executes when the player starts the game
        super.onResume();
        view.resume();                                   // Tell the gameView resume method to execute
    }


    @Override
    protected void onPause() {                 // This method executes when the player quits the game
        super.onPause();
        view.pause();                                   // Tell the gameView pause method to execute
    }
}
HeadingAndRotationView.java

package com.dpoon.headingandrotation;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

public class HeadingAndRotationView extends SurfaceView implements Runnable{
    Context context;
    Thread gameThread = null;                                                  // This is our thread
    SurfaceHolder ourHolder; // Our SurfaceHolder to lock the surface before we draw our graphics
    volatile boolean playing; // A boolean we will set and unset when the game is running- or not.
    boolean paused = true;                                       // Game is paused at the start
    Canvas canvas;                                                  // A Canvas and a Paint object
    Paint paint;
    long fps;                                             // This variable tracks the game frame rate
    private long timeThisFrame;                              // This is used to help calculate the fps
    int screenX;                                                // The size of the screen in pixels
    int screenY;
    Ship ship;                                                                 // The player's ship

    public HeadingAndRotationView(Context context, int x, int y) {
        super(context);                            // Ask the SurfaceView class to set up our object.
        this.context = context; // Make a global copy of the context so we can use it in another method
        ourHolder = getHolder();                          // Initialize ourHolder and paint objects
        paint = new Paint();

        screenX = x;
        screenY = y;

        ship = new Ship(context, screenX, screenY);                        // Make a new player space ship
    }

    @Override
    public void run() {
        while (playing) {
            long startFrameTime = System.currentTimeMillis();   // Capture the current time in milliseconds

            if(!paused){ update(); }                                            // Update the frame
            draw();                                                             // Draw the frame

            //Calculate the fps this frame. We can then use the result to time animations and more.
            timeThisFrame = System.currentTimeMillis() - startFrameTime;
            if (timeThisFrame >= 1) {
                fps = 500 / timeThisFrame;
            }
        }
    }

    private void update(){ ship.update(fps); }                                // Move the player's ship

    private void draw(){
        if (ourHolder.getSurface().isValid()) {      // Make sure our drawing surface is valid or we crash
            canvas = ourHolder.lockCanvas();                         // Lock the canvas ready to draw
            canvas.drawColor(Color.argb(255, 255, 68, 251));            // Draw the background color
            paint.setColor(Color.argb(255,  255, 255, 255));     // Choose the brush color for drawing

            // Now draw the player spaceship Line from a to b
            canvas.drawLine(ship.getA().x, ship.getA().y, ship.getB().x, ship.getB().y, paint);

            // Line from b to c
            canvas.drawLine(ship.getB().x, ship.getB().y, ship.getC().x, ship.getC().y, paint);

            // Line from c to a
            canvas.drawLine(ship.getC().x, ship.getC().y, ship.getA().x, ship.getA().y, paint);

            canvas.drawPoint(ship.getCentre().x, ship.getCentre().y,paint);
            paint.setTextSize(60);
            canvas.drawText("facingAngle = "+ (int)ship.getFacingAngle()+ " degrees", 20, 70, paint);
            ourHolder.unlockCanvasAndPost(canvas);                   // Draw everything to the screen
        }
    }

    public void pause() {                     // If the Activity is paused/stopped shutdown our thread.
        playing = false;
        try { gameThread.join(); }
        catch (InterruptedException e) { Log.e("Error:", "joining thread"); }
    }

    public void resume() {                         // If the Activity is started then start our thread.
        playing = true;
        gameThread = new Thread(this);
        gameThread.start();
    }

    // The SurfaceView class implements onTouchListener so we can override and detect screen touches.
    @Override
    public boolean onTouchEvent(MotionEvent motionEvent) {
        switch (motionEvent.getAction() & MotionEvent.ACTION_MASK) {
            case MotionEvent.ACTION_DOWN:                               // Player has touched the screen
                paused = false;
                if(motionEvent.getY() > screenY - screenY / 8) {
                    if (motionEvent.getX() > screenX / 2) {
                        ship.setMovementState(ship.RIGHT);
                    } else {
                        ship.setMovementState(ship.LEFT);
                    }
                }
                if(motionEvent.getY() < screenY - screenY / 8) {
                    ship.setMovementState(ship.THRUSTING);                               // Thrust
                }
                break;
            case MotionEvent.ACTION_UP:                     // Player has removed finger from screen
                ship.setMovementState(ship.STOPPED);
                break;
        }
        return true;
    }
}

Ship.java
package com.dpoon.headingandrotation;

import android.content.Context;
import android.graphics.PointF;

public class Ship {
    PointF a;
    PointF b;
    PointF c;
    PointF centre;
    float facingAngle = 270;                // Which way is the ship facing.  Straight up to start with
    private float length;                                             // How long will our spaceship be
    private float width;
    private float speed = 100; // This will hold the pixels per second speed that the ship can move at

    // These next two variables control the actual movement rate per frame
    // their values are set each frame based on speed and heading
    private float horizontalVelocity;
    private float verticalVelocity;

    private float rotationSpeed = 100;          // How fast does the ship rotate? 100 degrees per second

    public final int STOPPED = 0;                                      // Which ways can the ship move
    public final int LEFT = 1;
    public final int RIGHT = 2;
    public final int THRUSTING = 3;

    private int shipMoving = STOPPED;                    // Is the ship moving and in which direction

    public Ship(Context context, int screenX, int screenY) {                    // the constructor
        length = screenX / 5;
        width = screenY / 5;
        a = new PointF();
        b = new PointF();
        c = new PointF();
        centre = new PointF();
        centre.x = screenX / 2;
        centre.y = screenY / 2;
        a.x = centre.x;
        a.y = centre.y - length / 2;
        b.x = centre.x - width / 2;
        b.y = centre.y + length / 2;
        c.x = centre.x + width / 2;
        c.y = centre.y + length / 2;
    }

    public PointF getCentre() {
        return centre;
    }                                     // Getters and Setters

    public PointF getA() {
        return a;
    }

    public PointF getB() {
        return b;
    }

    public PointF getC() {
        return c;
    }

    float getFacingAngle() {
        return facingAngle;
    }

    // This method will be used to change/set if the ship is rotating left, right or thrusting
    public void setMovementState(int state) {
        shipMoving = state;
    }

    // This update method will be called from update in HeadingAndRotationView
    // It determines if the player ship needs to move and changes the coordinates
    // and rotation when necessary.
    public void update(long fps) {

        // Where are we facing at the moment. Then when we rotate we can work out by how much
        float previousFA = facingAngle;

        if (shipMoving == LEFT) {
            facingAngle = facingAngle - rotationSpeed / fps;
            if (facingAngle < 1) {
                facingAngle = 360;
            }
        }

        if (shipMoving == RIGHT) {
            facingAngle = facingAngle + rotationSpeed / fps;
            if (facingAngle > 360) {
                facingAngle = 1;
            }
        }
        if (shipMoving == THRUSTING) {

            // facingAngle can be any angle between 1 and 360 degrees the Math.toRadians method
            // simply converts the more conventional degree measurements to radians which are
            // required by the cos and sin methods.

            horizontalVelocity = (float) (Math.cos(Math.toRadians(facingAngle)));
            verticalVelocity = (float) (Math.sin(Math.toRadians(facingAngle)));

            centre.x = centre.x + horizontalVelocity * speed / fps;        // move the ship - 1 point at a time
            centre.y = centre.y + verticalVelocity * speed / fps;

            a.x = a.x + horizontalVelocity * speed / fps;
            a.y = a.y + verticalVelocity * speed / fps;

            b.x = b.x + horizontalVelocity * speed / fps;
            b.y = b.y + verticalVelocity * speed / fps;

            c.x = c.x + horizontalVelocity * speed / fps;
            c.y = c.y + verticalVelocity * speed / fps;
        }
        // Now rotate each of the 3 points by the change in rotation this frame facingAngle - previousFA
        float tempX = 0;
        float tempY = 0;

        a.x = a.x - centre.x;                                                       // rotate point a
        a.y = a.y - centre.y;

        tempX = (float) (a.x * Math.cos(Math.toRadians(facingAngle - previousFA)) -
                a.y * Math.sin(Math.toRadians(facingAngle - previousFA)));

        tempY = (float) (a.x * Math.sin(Math.toRadians(facingAngle - previousFA)) +
                a.y * Math.cos(Math.toRadians(facingAngle - previousFA)));

        a.x = tempX + centre.x;
        a.y = tempY + centre.y;

        b.x = b.x - centre.x;                                                   // rotate point b
        b.y = b.y - centre.y;

        tempX = (float) (b.x * Math.cos(Math.toRadians(facingAngle - previousFA)) -
                b.y * Math.sin(Math.toRadians(facingAngle - previousFA)));

        tempY = (float) (b.x * Math.sin(Math.toRadians(facingAngle - previousFA)) +
                b.y * Math.cos(Math.toRadians(facingAngle - previousFA)));

        b.x = tempX + centre.x;
        b.y = tempY + centre.y;

        c.x = c.x - centre.x;                                                   // rotate point c
        c.y = c.y - centre.y;

        tempX = (float) (c.x * Math.cos(Math.toRadians(facingAngle - previousFA)) -
                c.y * Math.sin(Math.toRadians(facingAngle - previousFA)));

        tempY = (float) (c.x * Math.sin(Math.toRadians(facingAngle - previousFA)) +
                c.y * Math.cos(Math.toRadians(facingAngle - previousFA)));

        c.x = tempX + centre.x;
        c.y = tempY + centre.y;
    }
}