Skip to content

Commit

Permalink
a lot of changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tasty-Kiwi committed Mar 24, 2024
1 parent fbfdc77 commit 8e4787f
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 104 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

[![Deploy to GitHub Pages](https://github.com/pewpewlive/ppl-docs/actions/workflows/deploy.yml/badge.svg)](https://github.com/pewpewlive/ppl-docs/actions/workflows/deploy.yml)

[![Test deployment](https://github.com/pewpewlive/docs/actions/workflows/test-deploy.yml/badge.svg)](https://github.com/pewpewlive/docs/actions/workflows/test-deploy.yml)

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation
Expand Down
4 changes: 3 additions & 1 deletion docs/File Information/sound-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ The following fields can be used to describe a sound:

:::tip

Use [jfxr] for sound creation. A script then transforms the resulting jfxr link (for example [this link]) into a table consumable by PewPew Live. See this [example].
Use [jfxr] for sound creation. A script then transforms the resulting jfxr link (for example [this link]) into a table consumable by PewPew Live.

See this [example].

:::

Expand Down
4 changes: 1 addition & 3 deletions docs/Guides/Lua/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ In this tutorial, we will learn how to make more advanced levels, including mesh

So, let's get straight into it.

---

### Note
## Note

Before we start, it is necessary to know at least some basic Lua and how to make a simple PewPew Live level. If you need a refresher, take a look at the Beginner and Intermediate tutorials.

Expand Down
68 changes: 29 additions & 39 deletions docs/Guides/Lua/beginner.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,70 +8,63 @@ sidebar_position: 1

These examples are more for review, rather than learning! If you see something here that you don't understand, continue to watch Lua tutorials on youtube!

### PRINTING EXAMPLE
## Printing example

```lua
print("Hello world!")
```

Output:
`Hello World!`
Output: `Hello World!`

```lua
print(2+3)
print(2 + 3)
```

Output:
`5`
Output: `5`

```lua
print("2+3")
print("2 + 3")
```

Output:
`2+3`
Output: `2 + 3`

Anything in quotation marks `" "` or `' '` is a string. Printing a string will output exactly what you type! Anything not inside of quotation marks are registered as numbers, variables, or mathematics!

### VARIABLES EXAMPLE
## Variables example

```lua
my_variable = 5
print(my_variable)
```

Output:
`5`
Output: `5`

```lua
x = 2
y = 10
print(x+y)
print(x + y)
```

Output:
`12`
Output: `12`

```lua
x = 2
y = 10
print("x+y")
print("x + y")
```

Output:
`x+y`
Output: `x + y`

```lua
some_text = "this is cool"
print(some_text)
```

Output:
`this is cool`
Output: `this is cool`

Variables can be assigned practically any value! You can store them as numbers, strings, and more!

### IF STATEMENT EXAMPLE
## If statement example

```lua
x = 6
Expand Down Expand Up @@ -129,7 +122,7 @@ Output:

Variables can also be assigned boolean values, which are true and false! With "and" statements, both or all arguments need to be true to equal true in total! With "or" statements, only one needs to be true to equal true in total! Both or all need to be false to be false in total!

### FOR LOOP EXAMPLE
## For loop example

```lua
for i = 1, 5 do
Expand Down Expand Up @@ -211,7 +204,7 @@ The following output is repeated 25 times:

For loops are useful for running the same code multiple times! The first line of the for loop has the syntax for i = Index, End Value, Increments. You set i as your starting value, separate with a comma, set your end value, and you can optionally set your increment as your third value. Don't forget the "do"!

### NESTED FOR LOOP EXAMPLE
## Nested for loop example

```lua
for i = 1, 5 do
Expand All @@ -235,19 +228,19 @@ This is the inner loop!
local swim_laps = 10
local paddles = 5
for i = 1, swim_laps do
print("Lap : "..i)
print("Lap: "..i)
for j = 1, paddles do
print("Paddle : "..j)
print("Paddle: "..j)
end
end
```

Output:

```
Lap : 1
Paddle : 1
Paddle : 2
Lap: 1
Paddle: 1
Paddle: 2
```

...etc.
Expand All @@ -260,12 +253,11 @@ for i = 1, 5 do
end
```

The following output is repeated 10 times:
`This is fine!`
The following output is repeated 10 times: `This is fine!`

You are allowed to put for loops inside of other for loops! In if you put a for loop that repeats 3 times inside of a for loop that repeats 5 times, that inner loop runs 15 times total! With for loops, you can use any variable as your index! And with nested for loops, it is good practice to use different variables, like using i and j instead of using i twice.

### WHILE LOOP EXAMPLE
## While loop example

```lua
local x = 3
Expand Down Expand Up @@ -307,12 +299,11 @@ while true do
end
```

The following output is repeated indefinitely:
`Hello!`
The following output is repeated indefinitely: `Hello!`

A while loop is very similar to a for loop, except you can think of it as an if statement and for loop combined! The while loop runs while the conditions are true. So for a while true do loop, the loop runs forever! Be careful when making a while true do loop!

### BREAK LOOPS EXAMPLE
## Break loops example

```lua
while true do
Expand All @@ -321,8 +312,7 @@ while true do
end
```

The above loop will only run once. Output:
`loop!`
The above loop will only run once. Output: `loop!`

```lua
x = 0
Expand Down Expand Up @@ -361,7 +351,7 @@ Output:

Using `break` is very useful! The purpose for `break` is to stop a loop from running! So using `break` in a for or while loop will ultimately terminate it!

### FUNCTIONS EXAMPLE
## Functions example

```lua
local function myFunction()
Expand Down Expand Up @@ -419,7 +409,7 @@ Output:

Functions are good for reducing the amount of code you have to write. If you have a piece of code you are going to use over and over with slightly different values, then make that piece of code a function! You can give functions **parameters** which is the num1 and num2 in myFunction(num1, num2). When you use the function later in your code, don't forget to fill in the parentheses! You can also use `return` to essentially turn a function into a value.

### TABLES EXAMPLE
## Tables example

```lua
local myTable = {1,5,3}
Expand Down Expand Up @@ -500,7 +490,7 @@ This person has 250 dollars!

Tables are very good for storing lots of information. You can even put things inside of tables after the table is made! Done with table.insert(TableName, data) or you add things with table[n] = data. And remember, the table doesn't have to be defined on the same line! The brackets {} can be on separate lines to make it easier to read!

### FOR I, V IN PAIRS LOOP EXAMPLE
## `for i, v in pairs()` loop example

```lua
local numbers = {3, 4, 99, 202, -3}
Expand Down
40 changes: 13 additions & 27 deletions docs/Guides/Lua/intermediate.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ If you are here, you made it through the learning process of the Lua language! K

Here, we will learn **how to make a PewPew Live Custom Level**

### GETTING STARTED

---
## Getting started

So in order to begin making a level, you will need to visit a couple of links.

Expand All @@ -20,9 +18,7 @@ https://pewpewlive.github.io/ppl-utils/ <--- This link right here is the PewP

**Also, make sure you have a text editor to make your code in! If you need help with this, go to the discord and ask about it in #technical-discuss!**

### PEWPEW LIVE API - FUNCTIONS

---
## PewPew Live API - functions

Before we begin in our first steps to making a level, it is crucial to understand the PewPew Live API.

Expand All @@ -34,9 +30,7 @@ These are some of the functions that you will be using in PewPew Live! I suggest

So you see, `print(String str)` would be typed in your code as `pewpew.print(String str)`. The black boxes with green text (things like `String`, `Int`, etc) tell you what kind of data the function uses, and what type of function it is! Don't worry too much about the type of function, focus mainly on the data that the functions take in, like `Int` and `String`.

### PEWPEW LIVE API - FMATH

---
## PewPew Live API - fmath

**Another main part of the API is the Fmath library!**

Expand All @@ -52,9 +46,7 @@ So `sqrt(FixedPoint x)` would be typed in your code as `fmath.sqrt(FixedPoint x)

Another main difference I should note is their decimals! It's a little strange, and I won't go into too much detail, but `2.6fx` does not exist. The number `2.5` is written as `2.2048fx`. It's strange, I know! And there is a specific and good reason for this! But for now, don't worry too much about decimals. If you need to use a number that isn't a full number, stick with fractions! Like instead of writing `2.2048fx`, write `5fx/2fx`! See? Much better! **Just remember that these fixed point numbers are mostly used for location and size!** In later examples we will see exactly how they are used!

### PEWPEW LIVE API - ENUMS

---
## PewPew Live API - enums

**The last main part that I need to cover is the Enums section of the API**

Expand All @@ -64,49 +56,43 @@ So what is an `Enum`? `Enum` stands for _Enumerator_, and is just a fancy way of

**We will go into detail on how to use Enums in specific ways, but for now, that is the general briefing on how to read the PewPew Live API!**

### WHERE DOES THE LEVEL GO?

---
## Where does this level go?

**So we are finally about to make our level. Where do we keep it? Well at the very top, you went to the main github page and downloaded the files, you need that!**

You will need to extract the file, and then you will enter it. You will see two files, a folder and an `.exe` file. That `.exe` is very important to running your level, keep it in mind!

![](https://i.imgur.com/CrvXuXT.png)
![Windows explorer window in ppl-utils directory](https://i.imgur.com/CrvXuXT.png)

**You will then see a bunch of files, and a folder. You do NOT need to worry about these files at all! Just the folder! The `levels` folder is where all custom levels are stored! So that is the folder you enter into next!**

![](https://i.imgur.com/JVRk9P6.png)
![Windows explorer window in ppl-utils/content directory](https://i.imgur.com/JVRk9P6.png)

**As you can see below, there are some levels already here! The developer, JF, put these levels here as examples for level creators to look at while they work! This is where you will create your level.**

![](https://i.imgur.com/mgmeZ0g.png)
![Windows explorer window in ppl-utils/content/levels directory](https://i.imgur.com/mgmeZ0g.png)

**So all you need to do is make a new folder. I'm going to call my folder TUTORIAL_LEVEL, although you can call your folder whatever you like.**

![](https://i.imgur.com/OoUkG9m.png)
![Windows explorer window in ppl-utils/content/levels directory and creating TUTORIAL_LEVEL directory](https://i.imgur.com/OoUkG9m.png)

And there you go! You now have the location of your custom level, and all the levels are nice and organized! Time for the fun stuff!

### OPEN YOUR LEVEL

---
## Open your level

**Here we can go into the environment that we need to code! Just to let you know, I use a text editor called Visual Studio Code. You may use something different, and again, if you need help with this text editor stuff, reach out in the discord!**

You can either open up just your level file in your text editor, or you can open the folder that contains all the levels. This is helpful for looking at other levels while you code! So head back to this screen below:

![](https://i.imgur.com/JVRk9P6.png)
![Windows explorer window in ppl-utils/content directory](https://i.imgur.com/JVRk9P6.png)

And open the levels folder with your text editor! If you need help with this, feel free to reach out for help! If you're ready, then proceed down below!

![](https://i.imgur.com/BfYNE64.png)
![Visual Studio Code window open in ppl-utils/content/levels directory](https://i.imgur.com/BfYNE64.png)

As pointed out by the very helpful green arrow, my level is on the left. The folder was initially empty. You need create a new script that will be your main level script. It HAS to be called `level.lua`. This is how PewPew Live enters into your level and runs it. It might change in the future, but it is good practice to keep consistency. And with the script made, you have an empty canvas. What's next?

### THE START OF A LEVEL

---
## The start of a level

**This next portion will go over how to make your map, and how to spawn the player. Yes! You have to put in the code that spawns the player yourself! But don't worry, it's not too terrible.**

Expand Down
Loading

0 comments on commit 8e4787f

Please sign in to comment.