Skip to content

Commit

Permalink
minor change, and a lesson
Browse files Browse the repository at this point in the history
  • Loading branch information
hexterminal committed Dec 3, 2024
1 parent 78fdab9 commit b681f27
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 3 deletions.
87 changes: 87 additions & 0 deletions courses/python/0.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Python - 0</title>
</head>
<body>
<h1>Lesson 0 of BGE Python</h1>
<h3>Intro</h3>
<p>
We'll look at how else you can code with Range Engine/UPBGE.
</p>
<!-- <h5>Things to know before learning the API</h5>
<ul>
<li>Grasping the basics of python properly will improve your workflow speed.</li>
<li>You can't do 100% python, ex. you need logic bricks to setup python.</li>
<li>You can not learn this within a day, it takes a lot of practice.</li>
</ul> -->
<!-- <figure>
<video src="../../img/xd.mp4" controls preload="none"></video>
<img src="../../img/pls-wait.png" loading="lazy">
<figcaption>some video goes here bro</figcaption>
</figure> -->
<h3>Setup</h3>
<h5>Ways to setup to code in python and GLSL</h5>
<ul>
<li>Using built-in text editor.</li>
<li>Using an external text editor or an IDE.</li>
</ul>
<h5>Using built-in text editor</h5>
<p>
Open up the engine, create a new panel by dragging or switch the editor type by clicking
on the editor type and clicking <b>Text Editor</b> or just press
<span class="mono">Shift</span> + <span class="mono">F11</span>.
Create a new text file by clicking on
the "+" icon or hover your mouse on the text editor and press
<span class="mono">Ctrl</span> + <span class="mono">N</span>.<br>
That is where you starting writing your python code.
</p>
<p>Pros</p>
<ul class="prosncons">
<li>Faster way to write code.</li>
</ul>
<p>Cons</p>
<ul class="prosncons">
<li>Undoing your code globaly undoes the whole blender workflow, resulting in a crash.</li>
<li>
Autocompletes with exisiting keywords in your code, shows up only after writing
some lines of code.
</li>
</ul>
<h5>Using an external text editor or an IDE</h5>
<p>
Open up notepad, <a href="https://vscodium.com/" target="_blank">vscodium</a>
(vscode if don't care about privacy), sublime-text or any other text editor or
an IDE, create a new <span class="mono" title="A blank Python file">.py</span> file
and save it. Open up the engine and open up the text editor, click on the
folder icon and open the file which you saved using the text editor.
Or you can do that with logic brick without opening your text file just
by specifying your code name and module name.
</p>
<p>Pros</p>
<ul class="prosncons">
<li>
Auto-complete is available in almost every code editors.
<p>
For vscode and vscodium,
<a href="https://marketplace.visualstudio.com/items?itemName=RangeEngine.range-engine-api">Range API autocomplete</a>
is available allowing users to write code faster.
</p>
</li>
<li>
Undoing doesn't crash and text editor manages it in a smarter way.
</li>
</ul>
<p>Cons</p>
<ul class="prosncons">
<li>
Opening a text file, saving it and switiing between the engine can be sligtly time consuming.
</li>
</ul>
<script src="../../code/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
<script type="text/javascript" src="../../code/syntax.js"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions courses/python/1.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ <h5>What the heck is hapening in this code</h5>
If you are a guy who's concerned about performance, this is for you.
</p>
<p>
<u title="or 'bge.logic.getCurrentController()'">cont = Range.logic.getCurrentController()</u>
Defining <span class="mono">cont</span> as <span class="mono">Range.logic.getCurrentController()</span>.
In <u title="or 'bge.logic.getCurrentController()'">cont = Range.logic.getCurrentController()</u>
we're defining <span class="mono">cont</span> as <span class="mono">Range.logic.getCurrentController()</span>.
This means you are getting the current Python controller which is one of the controllers list (and, or, nor, nand, xor, xnor)
associated with our python code. With that controller, you do stuff.
</p>
Expand Down
8 changes: 7 additions & 1 deletion courses/python/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,18 @@ <h2>What you'll learn</h2>
<div class="course-list">
<h3>list of lessons</h3>
<ul class="container-cl">
<a href='0.html' class="ccl">
<li>
<h5><span>00</span>How to setup</h5>
<p>Setting up to code.</p>
</li>
</a>
<a href='1.html' class="ccl">
<li>
<h5><span>01</span>How to code</h5>
<p>Use Range Engine or UPBGE API</p>
</li>
</a>
</a>
<a href='2.html' class="ccl">
<li>
<h5><span>02</span>Transforming Objects</h5>
Expand Down

0 comments on commit b681f27

Please sign in to comment.