Skip to content

Commit

Permalink
saving progress
Browse files Browse the repository at this point in the history
  • Loading branch information
leila010 committed Oct 10, 2024
1 parent 7a92419 commit f4c3f2e
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
56 changes: 55 additions & 1 deletion _notebooks/fundamentals/2024-09-30-variables_IO.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,60 @@
"\n",
"Make a new code block for some game elements that you have in your \"Ideation\"."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"vscode": {
"languageId": "javascript"
}
},
"outputs": [
{
"data": {
"application/javascript": "import GameControl from '{{site.baseurl}}/assets/js/rpg/GameControl.js';\n\n// Background data\nconst image_src = \"{{site.baseurl}}/images/rpg/water.png\";\nconst image_data = {\n pixels: {height: 580, width: 1038}\n};\nconst image = {src: image_src, data: image_data};\n\n// Sprite data\nconst sprite_src = \"{{site.baseurl}}/images/rpg/turtle.png\";\nconst sprite_data = {\n SCALE_FACTOR: 10,\n STEP_FACTOR: 1000,\n ANIMATION_RATE: 50,\n pixels: {height: 280, width: 256},\n orientation: {rows: 4, columns: 3 },\n down: {row: 0, start: 0, columns: 3 },\n left: {row: 1, start: 0, columns: 3 },\n right: {row: 2, start: 0, columns: 3 },\n up: {row: 3, start: 0, columns: 3 },\n};\nconst sprite = {src: sprite_src, data: sprite_data};\n\n// Assets for game\nconst assets = {image: image, sprite: sprite}\n\n// Start game engine\nGameControl.start(assets);\n```\n",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%js\n",
"import GameControl from '{{site.baseurl}}/assets/js/rpg/GameControl.js';\n",
"\n",
"// Background data\n",
"const image_src = \"{{site.baseurl}}/images/rpg/water.png\";\n",
"const image_data = {\n",
" pixels: {height: 580, width: 1038}\n",
"};\n",
"const image = {src: image_src, data: image_data};\n",
"\n",
"// Sprite data\n",
"const sprite_src = \"{{site.baseurl}}/images/rpg/turtle.png\";\n",
"const sprite_data = {\n",
" SCALE_FACTOR: 10,\n",
" STEP_FACTOR: 1000,\n",
" ANIMATION_RATE: 50,\n",
" pixels: {height: 280, width: 256},\n",
" orientation: {rows: 4, columns: 3 },\n",
" down: {row: 0, start: 0, columns: 3 },\n",
" left: {row: 1, start: 0, columns: 3 },\n",
" right: {row: 2, start: 0, columns: 3 },\n",
" up: {row: 3, start: 0, columns: 3 },\n",
"};\n",
"const sprite = {src: sprite_src, data: sprite_data};\n",
"\n",
"// Assets for game\n",
"const assets = {image: image, sprite: sprite}\n",
"\n",
"// Start game engine\n",
"GameControl.start(assets);\n",
"```"
]
}
],
"metadata": {
Expand All @@ -318,7 +372,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.5"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions _notebooks/fundamentals/POPCORN HACK 1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 6,
"metadata": {
"vscode": {
"languageId": "html"
Expand Down Expand Up @@ -293,7 +293,7 @@
" \n",
" blockSize += 5; // Compound assignment example\n",
"\n",
" if (width >= 1 && width <= 100000) {\n",
" if (width >= 1 && width >= 100000) {\n",
" document.getElementById('output').innerHTML = \"Scale set to: \" + width + \" x \" + height + \" (Block size: \" + blockSize + \"px)\";\n",
" block.style.width = blockSize + \"px\";\n",
" block.style.height = blockSize + \"px\";\n",
Expand Down

0 comments on commit f4c3f2e

Please sign in to comment.