-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestes2.js
More file actions
62 lines (49 loc) · 898 Bytes
/
testes2.js
File metadata and controls
62 lines (49 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
let tipos = {
PAREDE:0,
CHAO:1,
PLAYER:2,
INIMIGO:3,
ITEM:4
}
let selecao = {
ipaleta:0,
spr:0,
img:0,
tipo:tipos.CHAO //parede chao player
}
let entidade = {
ipaleta : 3, //indice da imagem na paleta[i]
rotation : 0.0,
scale:0.0,
x : 0.0,
y : 0.0,
tipo: tipos.CHAO //parede inimigo item
}
var mapa = []
function preload()
{
fill2DimensionsArray(mapa,10,10)
mapa[1][1].ipaleta = 2
console.table(mapa)
}
function setup()
{
gspr = new Group()
createCanvas (800,800);
noSmooth()//importante sempre usar
}
function draw()
{
clear()
background(130)
camera.on();
allSprites.draw()
}
function fill2DimensionsArray(arr, rows, columns){
for (var i = 0; i < rows; i++) {
arr.push([0])
for (var j = 0; j < columns; j++) {
arr[i][j] = structuredClone(entidade);
}
}
}