-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsketch.js
61 lines (42 loc) · 1.24 KB
/
sketch.js
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
var waitbgimg
var gameState="wait"
function preload(){
waitbgimg=loadImage("assets/splash3.gif")
playerimg=loadImage("assets/player1.png")
player2img = loadImage("assets/player2.png")
playerSelectionBg = loadImage("assets/playerSelect.gif")
}
function setup(){
createCanvas(windowWidth,windowHeight)
playButton = createImg("assets/startbutton2.png")
playButton.position(width/2 - width/8,height/5 *3)
playButton.size(width/4,height/4)
nextButton = createImg("assets/button.png")
nextButton.position(width/2 - 300,height-400)
nextButton.size(500,300)
nextButton.hide()
player=createSprite(width/3,height/4 *2.4)
player.addImage(playerimg)
player.scale=windowHeight/1503.3333333333335
player.visible=false
player2=createSprite(width/3 *2,height/4 *2.4)
player2.addImage(player2img)
player2.scale=windowHeight/902
player2.visible=false
}
function draw(){
console.log(windowHeight)
if (gameState==="wait"){
background(waitbgimg)
}
playButton.mousePressed(()=>{
gameState="playerSelect"
playButton.hide()
})
if(gameState==="playerSelect"){
background(playerSelectionBg)
player.visible=true
player2.visible=true
}
drawSprites()
}