-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix climb & show robo methods in Controller
- Loading branch information
1 parent
5d12267
commit fea1bcf
Showing
5 changed files
with
111 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,46 @@ | ||
<script lang="ts" setup> | ||
import PopUp from "~/components/PopUp.vue"; | ||
import {Robot} from "~/classes/Robot"; | ||
const p = defineProps<{ | ||
robo: Robot, | ||
}>() | ||
function callFunction(functionName) { | ||
window["Robo"][functionName](); | ||
} | ||
let RoboMethods = $ref(Object.getOwnPropertyNames(Object.getPrototypeOf(p.robo))) | ||
</script> | ||
<template> | ||
<div class="w-full bg-gray-200 h-20 flex justify-between p-6"> | ||
<button> | ||
Play | ||
</button> | ||
<button> | ||
? | ||
</button> | ||
<div class="flex gap-2"> | ||
<button | ||
class="p-4 border-2 border-gray-500 rounded-xl flex place-items-center" | ||
v-for="methode of RoboMethods" | ||
@click="callFunction(methode)" | ||
>{{ methode }} | ||
</button> | ||
</div> | ||
<PopUp> | ||
<h2 class="text-5xl">Aufgabe 1</h2> | ||
<article> | ||
The console is a panel that displays important messages, like errors, for developers. Much of the work the | ||
computer does with our code is invisible to us by default. If we want to see things appear on our screen, we can | ||
print, or log, to our console directly. | ||
Definition by: https://www.codecademy.com/ | ||
|
||
robo.log('teach-a-bot') | ||
|
||
robo.log(2500) | ||
|
||
1.1 Use the console.log code in the editor to log the Name of your Robo to the console (String). | ||
1.2 On the next line, write another console.log to print out the age of your Robo (Number). | ||
1.3 Try another Age and another Name. | ||
|
||
Run your code when you are ready to see the result. | ||
</article> | ||
</PopUp> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
<script lang="ts" setup> | ||
import {Robot} from "~/classes/Robot" | ||
defineProps<{ | ||
const p = defineProps<{ | ||
robo: Robot, | ||
}>() | ||
console.log('Robo: ', p.robo); | ||
</script> | ||
|
||
<template> | ||
<div class="grid aspect-square bg-green-50" style=" | ||
grid-template-columns: repeat(24, minmax(0, 1fr)); | ||
grid-template-rows: repeat(24, minmax(0, 1fr));"> | ||
<div | ||
class="bg-gray-500" | ||
:style="{gridRowStart: 24 - robo._y, gridColumnStart: 1 + robo._x}" | ||
></div> | ||
|
||
<div v-for="obst of robo._level.obstacles" class="bg-black" | ||
:style="{gridColumnStart: obst, gridRowStart: 24}"/> | ||
:style="{gridColumnStart: 1 + obst, gridRowStart: 24}"/> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<script lang="ts" setup> | ||
let toggle = $ref(false) | ||
</script> | ||
|
||
<template> | ||
<div @click="toggle = !toggle" class="text-3xl"> | ||
? | ||
</div> | ||
<div v-if="toggle" style="background: rgba(0,0,0,0.5)" class=" | ||
fixed top-0 bottom-0 left-0 right-0 | ||
grid place-content-center"> | ||
<div class=" relative w-[80vw] h-[80vh] bg-white rounded-xl p-10"> | ||
<button @click="toggle = !toggle" | ||
class="absolute right-4 top-2 text-3xl">x | ||
</button> | ||
<div class="grid gap-6 text-2xl font-bold overflow-scroll"> | ||
<slot/> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters