aboutsummaryrefslogtreecommitdiff
path: root/src/paperflight/static/items.js
blob: c368f81d531bb384d45526ed8f63ea3df766b65d (plain)
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
63
64
65
/**
 * Contains functions to create each type of object that can
 * appear in a level. 
 */

function constructVent(x, y, width, height, state=-1){
    return {
        draw: drawVent,
        update: updateVent,
        wind: [],
        x, y, width, height, state
    }
}
function constructCoin(x, y, radius=10){
    return {
        draw: drawCoin,
        update: updateCoin,
        collected: false,
        x, y, radius
    }
}
function constructBlock(x, y, width, height){
    return {
        draw: drawBlock,
        update: updateBlock,
        x, y, width, height
    }
}
function constructRamp(x, y, width, height, slope){
    return {
        draw: drawRamp, 
        update: updateRamp, 
        x, y, width, height, slope
    }
}
function constructSwitch(x, y, width, height, stateCount){
    return {
        draw: drawSwitch,
        update: updateSwitch,
        x, y, width, height, stateCount
    }
}
function constructSwitchRect(x, y, width, height, state){
    return{
        draw: drawSwitchRect,
        update: updateSwitchRect,
        x, y, width, height, state
    }
}
function constructText(x, y, text, font){
    return {
        draw: drawText,
        update: () => {},
        style: "black",
        x, y, text, font
    }
}
function constructDrip(x, y, frequency){
    return {
        draw: drawDrip, 
        update: updateDrip,
        drips: [],
        x, y, frequency
    }
}