Parallax
- 7 Devlogs
- 25 Total hours
An AI physics Tutor
An AI physics Tutor
In the last 3 days, I finished the projectile motion simulator and added sliders, created a boss battle at the end of the unit, and created a home screen with lessons in a parabola galaxy
The projectile motion simulator has two sliders — angle and speed — which a user can use to change the motion of a projectile. This was moved to lesson 1.5, the lesson about motion in 2-Dimensions, and allows users to learn through experimentation
The boss battle uses questions from all the lessons. Once a user answers a question correctly, they get a chance to use the same projectile motion simulator to hit the boss. If they are within 25px of the boss, the boss loses 1hp. If the user answers a question incorrectly, they lose a life. At the end, the user either completes Unit 1 or has to try again. I plan to add several units in the future, following the AP Physics 1 layout, where defeating a boss will create a new unit
Throughout the project, I also had to write several CSS classes myself! You can read the DEVLOG for more info on the project!
AI usage: used AI to help me understand concepts when I got stuck for over 5 minutes on a topic and test my code. I used AI to teach me the concept, then I coded everything by myself and asked for feedback on the code to improve it. AI was used to test the app and write lessons 1.3-1.5
Over the course of the last 3-4 days, I created a projectile motion simulation where the user can control speed and angle of the projectile. The code uses real kinematic equations to solve for the new position of the projectile given time. This then maps to a mapCanvas(t) function that allows the equations to give the coordinates for a working website and canvas HTML element. Finally, I created a drawFrame() function to actually paint the simulation so that it looks like the projectile is consistently moving to human eyes.
There were many bugs along the way. This included learning curves such as learning the requestAnimationFrame() function, making sliders, and even writing some part of CSS !
1. One important concept is that the canvas starts (0,0) from the top left corner of the grid, so subtracting y actually makes an object/line move upward.
2. I learned to use the function beginPath() to create a new drawing object. Without using beginPath(), an drawing connects a the previous drawing to the new drawing with a line. Additionally, the fill() function needs to be used to actually draw a point.
3. I learned that css uses different punctuation for different rules:
selector (plain word) - looks for elements with tag
.selector - looks for elements whose classes list contains the word
#selector - looks for the element with the ID
:selector - does the css action only while it is in the state
4. You can test with console.log. To open it on a website/app screen, you can use CMD+OPT+J
Today, I first deployed the app on vercel! Then, I created progress.js; This file has a function to loadProgress() and saveStars(). Finally, I added function calls to main.js to use the functions in the functionality of the app.
used AI to help me understand concepts when I got stuck for over 5 minutes on a topic and test my code. In this specific session, I had a lot of obstacles, especially with learning new javascript functions and syntax. There were 6 attempts just to solve the progress.js page, and AI helped me understand javascript better, as shown in the key learnings below.
1. You need to use the "export" keyword so that a function in one page can be used by other files
2. In javaScript, you don't have to manually create tables/lists like how you use the "new" keyword in java. If you say scores["math"] = 60 and math does not exist, then it will create a new row called "math" in the table and assign the value of 60 to the key.
3. Through 6 attempts, I learned a lot of Java Script syntax features:
a. A dot is used to get an attribute in javascript, something that belongs to an object. However, tables in javascript use brackets just like lists: table[];
b. You can save a whole table using .setItem(key, value). Remember that the value has to be a string. We can use .stringify(obj) for this.
c. Javascript has two error words: null and undefined. Null happens from an intentionally missing object. For example, when an object has been declared but is empty. Undefined, by contrast, is used when the object has never been created and their is no instance of it.
d. Extra JavaScript functions are as follows:
i. stringify --> turn an object into a string
ii. parse --> turn a string back into an object
iii. setItem --> changes the item in a table
iv. getItem --> gets the item currently in a table
4. If you need to import multiple things from the same page/file, you can use a comma in the import instead of using multiple lines.
I am going to create an interactive projectile simulator!
Today, I finished the mini-quiz in the first lesson. I have included colors to indicate wrong and write answers (that comes from the css) and I created 4 buttons that are clickable and display the answer choices.
Additionally, I added stars to the lesson to act as the lesson score. This depends on their score on the lesson quiz.
Now that I have developed one whole lesson, I will use the same code to develop a total of 5 lessons to cover Unit 1: Kinematics of the AP Physics 1 curriculum. Then, I will create a home screen. If I have time, I will make the first-ever deployment to Vercel and see the app in action!
AI usage: I used AI to help me understand concepts when I got stuck for over 5 minutes on a topic. I always try to write code myself, but I learn the concept I am struggling with after using AI.
Day 9 - Creating the first lesson + quiz
Today, I created the official first lesson of parallax. The first lesson follows the AP Physics 1 college curriculum. This starts with the Kinematics Unit. The first topic covered in the unit is Scalars and Vectors.
Learned:
1. Today I learned that we use the === operator to check if both the datatype and value of two variables being compared is the exact same.
2. I also learned that when creating elements in a .js file, you can name elements anything, such as questionText instead of “p”. It is important to do this so that the compiler/program does not crash because only one const element can have the same name.
3. I learned that there is a hidden property that works on elements such as div. This is just like how disabled works on buttons!
4. I learned the syntax of a forEach loop: element.forEach((element, index) => {});
AI usage: After writing my first draft of the lesson code and checking the mini-quiz inside the first lesson, I had multiple errors. I used AI to explain the errors, which are documented in the key learning above. Additionally, I used AI to verify the code and test the app itself with its capabilities.
Make the App look good!
Today, I added a stylesheet (made by AI) to make my app look more modern and appealing. Since I am coding the structure of the app, this is ok. Along the way, I learned how to incorporate CSS as classes in both HTML and JavaScript. I also learned that JavaScript uses the classListadd method to add classes, while HTML is just a direct type-in. I am hoping to learn more CSS in the process. My next step is to add new components such as a sidebar and more interactive features.
Home screen + Learning React/HTML
For the first few hours of the project, I spent directing AI on how to create an amazing AI tutor. However, I decided to restart from scratch to create an app that is self-coded. I worked on the new app from scratch for 2 hours, and I was able to create one lesson. I focused on the lesson structure and added a start, next, and back button. I am planning to focus on the structure of the app before appealing to aesthetics.