Posts

Last Day of the Semester

Today was my last day at my internship which is kind of sad, but I am hoping to go back to the Flatiron School next semester. When I got to my internship today, I started to work on my code and I ended up breaking it. "Welp, here we go again," I thought to myself. I broke my collision with the bird. Also, my character wasn't moving. This is all apart of coding. You break your code and then you try and fix it, and then you break it again. A pattern starts to form that keeps on happening. My first approach was trying to figure it out myself by going through the errors on the console, but I couldn't figure it out. I then looked at my GitHub account which is where I can commit my code. Basically, committing your code means that you save your code to this website called GitHub. When your code is working, you will want to commit it, so that if you break your code again, you can look back at your old code that was previously working. I did this, but my code was a lot more ad...

Finally Abstracting my Code and Making an Ice Rink

Today at my internship I worked on abstracting my code. I was finally able to do it. After some help from my internship guy, I was able to abstract out my characters.  These included my bird, the little guy, and the sky. How I did this is pretty complicated, yet very simple when it was explained to me.    First, you make another js file in your folder that already has your HTML file. In this Js file, you want to put everything that applies to one character in it. For instance, if I was abstracting the little guy, then I would take all of the code that created the guy and puts him on the page. Once you have this in another js file, you want to call that js file in your HTML file. This makes it so the HTML recognizes that you want to use a specific js file in your code. I essentially did this for my bird and my sky. Although when I did this, there was one dilemma that I ran into. The dilemma that I ran into was that I couldn't see my character. I was so con...

Implementing Classes

Image
    Today I went to my internship ready to study and learn. I got to the Flatiron School and started to work on my code, but then I went to a standstill. I first opened up the HTML link in google chrome. I saw the sky, the bird, and the man, which is a very good sign. I then tried to move my little guy through the use of my arrow keys, but I just got an error. My little guy was stuck at a standstill. I spent a lot of time looking at my code to see what might be causing this error, but I couldn't find it. I kept trying and trying but soon just decided on asking for help. My Internship guide looked at my code and was able to see the problem. The problem was with one of my variables in my crash function.     After we fixed this problem, It was time to implement classes into my code. Classes essentially just help to clean up your code. So, I put in a class for my little guy, saved it, and then opened the code up in google chrome. I looked at the screen, and t...

Making Classes

    Today I went to my internship and I worked on making classes for my code. A class is essentially for cleaning up your code. It stores a bunch of information in that class which can later be called in the main code.  I started reading about this, and I found some text that seemed very complicated. To my surprise, making a class wasn't as complicated as I thought, although implementing a class into my code is a whole different story.     I made a bunch of classes while I was at my internship. The class I worked on first was for movement. So all of the variables assigned to the keys so that the little guy can walk. There was also a class for the character itself. Another class was made for the bird. The bird in the code posed as an obstacle for my character. When my character came into contact with the bird, he would stop. I also made a class for the crash. This had my huge if statement saying that "if the man (the makeshift square) came into contact...

Crashing and Stopping

Image
    Today at my internship I worked on making my little person stop when he crashed into the bird. I implemented the bird in my code last week. This was pretty difficult when I started to do it, but I soon got the hang of it.     First I needed to find the dimensions of my little character. Since my little guy isn't a perfect square, I had to make one. Instead of finding some complicated dimensions of this abstract guy, I just put the dimensions of a square that was very close to the height and width of the little guy. After I did this, I did the same thing with the bird. Since the bird is also an abstract shape, I found the dimensions of a square that was very close to the height and width of the bird.     Now came the hard part for me. I then had to find a way to say that "if this first square (the little guy) crashes into this other square (the bird) then console.log("Crashed") + stop(). The last part of the if statement might seem confusing, but it is...

Making Obstacles

Image
Making Obstacles Today at my Internship, we worked on our same project. Although, today we implemented this little bird into our code. It seemed very complicated at first, but then I looked at my code and noticed that I was basically doing the same thing with another image that was already put onto the page.         How I did this was simple. First I was able to drag the image into visual studio. Visual Studio is an app that allows one to run Javascript and HTML files. Then you have to assign where the bird is going to be on the page. Do you want it to be at the very top left? Do you want the bird to be at the bottom? Do you want the bird to be in the middle? I made it so the bird was on the top left-hand side of the screen. I am now trying to make it so that whenever the little guy runs into the bird, the stop function commences. As a review, my stop function essentially stops the little guy on the screen from walking. Instead of me typing stop(), the ...

Using the Arrow Keys

Using the Arrow Keys     Today was the third time being at my internship. Exciting right!! I continued on the same project that I have been working on from last week. Last week I worked on making a little giph walk north, east, south, and west, through the use of some functions. I would essentially call a function that I had already created. For instance, if I called walkNorth(). This is telling the console that I have called this variable, and that the computer is going to find this walkNorth() variable and run what this variable is assigned to do. In this case, I assigned this variable to walk north. How I did that is a little more complicated, so for now, all you need to know is that this giph walks north when the variable walkNorth() is called. I also made different variables called walkEast(), walkSouth(), and walkWest, and assigned them to walk in there specific direction. Calling these variables one by one is kind of inconvenient because I would h...