Prettier water
This commit is contained in:
parent
d83e23cd43
commit
d48cf64816
@ -4923,7 +4923,17 @@
|
|||||||
},
|
},
|
||||||
{"name": "Balloon", "id": 36, "_eid": "16494694", "x": 1296, "y": 176, "originX": 0, "originY": 0},
|
{"name": "Balloon", "id": 36, "_eid": "16494694", "x": 1296, "y": 176, "originX": 0, "originY": 0},
|
||||||
{"name": "Balloon", "id": 37, "_eid": "16494694", "x": 1360, "y": 160, "originX": 0, "originY": 0},
|
{"name": "Balloon", "id": 37, "_eid": "16494694", "x": 1360, "y": 160, "originX": 0, "originY": 0},
|
||||||
{"name": "Balloon", "id": 38, "_eid": "16494694", "x": 1264, "y": 128, "originX": 0, "originY": 0}
|
{"name": "Balloon", "id": 38, "_eid": "16494694", "x": 1264, "y": 128, "originX": 0, "originY": 0},
|
||||||
|
{
|
||||||
|
"name": "Spring",
|
||||||
|
"id": 39,
|
||||||
|
"_eid": "24018769",
|
||||||
|
"x": 912,
|
||||||
|
"y": 336,
|
||||||
|
"originX": 0,
|
||||||
|
"originY": 0,
|
||||||
|
"values": {"angle": 180, "strength": 7}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -11,20 +11,31 @@ class Water(BaseObject):
|
|||||||
|
|
||||||
self.depth = 2
|
self.depth = 2
|
||||||
|
|
||||||
self.sprite = game.pygame.Surface((game.DISPLAY_WIDTH,game.DISPLAY_HEIGHT),flags=game.pygame.SRCALPHA)
|
self.sprite = game.pygame.Surface((game.DISPLAY_WIDTH,game.DISPLAY_HEIGHT))
|
||||||
self.sprite.fill([10,100,180])
|
self.sprite.set_alpha(180)
|
||||||
self.sprite.set_alpha(200)
|
|
||||||
|
|
||||||
self.surfacepoints = []
|
white = [245,237,186]
|
||||||
self.nbpoints = 50
|
cyan = [126,196,193]
|
||||||
for i in range(self.nbpoints):
|
blue = [52,133,157]
|
||||||
self.surfacepoints.append([game.DISPLAY_WIDTH/self.nbpoints*i,0])
|
dark = [23,67,75]
|
||||||
|
slides = [[3,white],[8,cyan],[2,blue],[5,cyan],[2,blue],[2,cyan],[120,blue],[5,dark],[10,blue],[20,dark],[10,blue]]
|
||||||
|
self.slides = []
|
||||||
|
offset = 0
|
||||||
|
for i in slides:
|
||||||
|
surf = self.game.pygame.Surface((game.DISPLAY_WIDTH,i[0]))
|
||||||
|
surf.fill(i[1])
|
||||||
|
self.slides.append([surf,offset])
|
||||||
|
offset+=i[0]
|
||||||
|
|
||||||
def step(self):
|
def step(self):
|
||||||
|
|
||||||
self.rect[1] += (self.destinationy-self.rect[1])*self.game.dt*self.speed
|
self.rect[1] += (self.destinationy-self.rect[1])*self.game.dt*self.speed
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
|
# Prepare the sprite
|
||||||
|
self.sprite.fill([23,67,75])
|
||||||
|
for i in self.slides:
|
||||||
|
posy = min(self.rect[1]-self.game.globals["cameray"],0)+i[1]
|
||||||
|
self.sprite.blit(i[0],[0,posy])
|
||||||
# Draw the water to the screen
|
# Draw the water to the screen
|
||||||
self.game.window.blit(self.sprite,[self.rect[0],self.rect[1]-self.game.globals["cameray"]])
|
drawy = max(self.rect[1]-self.game.globals["cameray"],0)
|
||||||
|
self.game.window.blit(self.sprite,[0,drawy])
|
||||||
|
Loading…
Reference in New Issue
Block a user