File tree Expand file tree Collapse file tree 1 file changed +73
-0
lines changed
Expand file tree Collapse file tree 1 file changed +73
-0
lines changed Original file line number Diff line number Diff line change 1+ ## Variable type
2+
3+ * Nil : None
4+ * Boolean : true or false
5+ * Number : int or float
6+ * string : characters
7+
8+ declare-> just use '=' to declare variable name and the value should stored
9+
10+ * variable name can't start with number but can contain them
11+
12+ * variable names can't contain symbol but '_ '
13+
14+ * variables are case sensitive
15+
16+ use '--' to make a comment
17+
18+ * table : like python dictionary. you can use table to store various type of variables.
19+ sample:
20+
21+ > table = {} -- declare a table
22+ > table.num = 10 -- number in table
23+ > table.table2 = {} -- table in table
24+ > table2 = {num = 10, table3 = {}}
25+
26+ ---
27+ ## if operators
28+ ==: equal
29+ ~ =: not equal
30+ < : less
31+ \> : greater
32+ <=: less or equal
33+ \> =: greater or equal
34+
35+ > if condition then
36+ > --trigger
37+ > end
38+
39+ > if condition and condition2 then
40+ > --trigger
41+ > elseif confition3 then
42+ > --trigger
43+ > else
44+ > --trigger
45+ > end
46+
47+ ---
48+
49+ ## function
50+
51+ > function function_name()
52+ > -- trigger and detect
53+ > end
54+
55+ love2D 3 main function
56+
57+ > function love.load()
58+ > -- will trigger when you start the game
59+ > -- where you load all the data and assets
60+ > end
61+
62+ > function love.update(dt)
63+ > -- program the actual game logic
64+ > -- anything you need to update will in the end be handled in here
65+ > -- will trigger 1 time per frame produced by computer. Depend on your computer.
66+ > -- might be run mutiple times of others.
67+ > -- so we need 'dt' as delta time to make adjust as index.
68+ > end
69+
70+ > function love.draw()
71+ > -- display graphics on the screen
72+ > end
73+
You can’t perform that action at this time.
0 commit comments