waterdrop | 2D space game based on The Three-Body Problem | Game Engine library
kandi X-RAY | waterdrop Summary
kandi X-RAY | waterdrop Summary
The WaterDrop is a 2D space game based on The Three-Body Problem, which is the famous sci-fi novel wrote by CiXinLiu. In this game, you would drive the waterdrop created by the three-body creatures. The waterdrop is made of special meterials which enables you to destory the enemies (spaceships made by human) by direct collision.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Runs the game
- Load picture file
- Tick bullet
- Create a space
- Start the game
- Called when the game button is pressed
waterdrop Key Features
waterdrop Examples and Code Snippets
Community Discussions
Trending Discussions on waterdrop
QUESTION
I'm trying to make a waterdrop svg that shows what level the water is in a tank. I do this with a linear gradient, so I can display graphically (and easily) if the water is half or full, etc. In this example I show the tank is half full. I'd like to add a 3D affect to the water drop, and found a way to do it with a radial gradient but can't figure out a way to load both gradients at the same time to the same svg image and if that's not possible does someone have an idea how they'd do the below instead? I DO NOT want the Click here in my example it just shows the 3D appearance I'm trying to add to the half full droplet. Hope you get what I mean, is there a way I can have both gradients on the single svg image when the page loads? Thank you.
...ANSWER
Answered 2021-Sep-08 at 06:42Now the blue color is the same for both gradients you can use the linear gradient as a mask on the drop. The mask is made from a and the drop
itself. Is it something like that?
This brakes your click event, but I guess you can figure that out :-)
Update: I made part of the linear gradient dark gray (#444) so that the radial gradient can be seen in the "empty" part of the drop.
QUESTION
I have an observable class, where I have 4 @Published variables. The view is not redrawing when the @Published variables changing their value. I included my code to make it clear. The value in the viewModel is being changed because I can see how they are changing in the Debug console. What am I missing? 0
...ANSWER
Answered 2021-Aug-20 at 01:44At the moment you are using a number of separate CustomDrinkViewModel, and so a change in one does not relate to the others.
Although I cannot see where you actually change the customDrinkDocument, try these modifications:
QUESTION
import pygame
import sys
from pygame.sprite import Sprite
class Settings:
def __init__(self):
self.raindrop_speed = 3
self.raindrop_direction = -1
self.raindrop_dropseed = 3
self.backgroundcolor = (30,30,30)
class Drop(Sprite):
def __init__(self):
super().__init__()
self.image = pygame.image.load("raindrop.png")
self.rect = self.image.get_rect()
self.rect.y = self.rect.height
self.rect.x = self.rect.width
self.x_cord = self.rect.x
self.y_cord = self.rect.y
class RainDrop:
def __init__(self):
pygame.init()
self.screen = pygame.display.set_mode((1200,800))
self.settings = Settings()
self.backgroundcolor = self.settings.backgroundcolor
self.raindrops = pygame.sprite.Group()
self.screen_rect = self.screen.get_rect()
self._add_raindrops()
def _add_raindrops(self):
new_raindrop = Drop()
drop_height = new_raindrop.rect.height
drop_width = new_raindrop.rect.width
print(drop_width)
screen_space = self.screen_rect.width
screen_height_space = self.screen_rect.height
aviable_row_space = screen_height_space//(drop_height*2)
avivable_screen_space = screen_space - (drop_width*2)
amount_of_columns = avivable_screen_space//(drop_width*2)
self._add_columns(amount_of_columns,aviable_row_space)
def _add_columns(self,amount_of_columns,aviable_row_space):
for height_of_drops in range(aviable_row_space):
for number_of_drops in range(amount_of_columns):
drop = Drop()
drop.x_cord = (drop.rect.width *2)* number_of_drops
drop.y_cord =(drop.rect.height *2)* height_of_drops
drop.rect.x = drop.x_cord
drop.rect.y = drop.y_cord
self.raindrops.add(drop)
def _bring_down_raindrops(self):
for drop in self.raindrops:
drop.y_cord += self.settings.raindrop_dropseed
drop.rect.y = drop.y_cord
def _update_drops(self):
height_counter = 1
self.raindrops.update()
for drop in self.raindrops.copy():
drop.x_cord += self.settings.raindrop_direction * self.settings.raindrop_speed
drop.rect.x = drop.x_cord
if drop.rect.right >= self.screen_rect.right:
self.settings.raindrop_direction = -1
self._bring_down_raindrops()
elif drop.rect.left <= 0:
self.settings.raindrop_direction = 1
self._bring_down_raindrops()
#if drop.rect.y >= self.screen_rect.height or drop.rect.y <= 0:
# drop.rect.x = drop.rect.width
# drop.y_cord = drop.rect.height
# drop.rect.y = drop.y_cord
print(height_counter)
print(self.raindrops)
def _update_game(self):
self.screen.fill(self.backgroundcolor)
self.raindrops.draw(self.screen)
pygame.display.flip()
def _check_events(self):
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
sys.exit()
def run_game(self):
while True:
self._check_events()
self._update_drops()
self._update_game()
if __name__ == "__main__":
rd = RainDrop()
rd.run_game()
...ANSWER
Answered 2021-Feb-22 at 03:40Your problem is in what you do when you recognize that you've hit the edge of the screen. You do this when you find any drop that has gone off of the screen, and at that point, you reverse direction. The problem is, you've already moved some of the drops on the top row in one direction, but after you recognize the edge of the screen, you then go on to move the rest of the drops in the opposite direction in that same pass. This is how things get out of wack.
What you want to do is note that you've hit the edge of the screen, but not do anything differently right away, so that you still deal with all of the drops on the screen the same way in that pass. After you've drawn all of the drops, you then change direction.
Here's a version of _update_drops
that will do this:
QUESTION
I want an irregular animation like this(This is in case of a waterdrop):
Drip
nothing
Drip
Drip
Drip
nothing
nothing
Is there a way to do this or loop a really long animation of dripping?
...ANSWER
Answered 2020-Sep-07 at 13:08One of the simplest ways I have found to do things like "tracked" animation is by using this stable repository
https://github.com/protyze/aframe-alongpath-component
Setup your water droplets alongpath and animate them with your own fixed x,y,z coordinates. Change my x,y,z's for the horse into a vertical. Unless you want to do something more complex, this I believe is one simple way.
QUESTION
Okay so I'm trying to create a discord bot command (broadcast) and I want to get the args[0] as an ID to the broadcast channel, but when I try it this is what it logs:
...ANSWER
Answered 2020-Jul-21 at 13:50Cannot read property '0' of undefined
means that args
is undefined.
You need to define the args variable before using it.
You can do something like this: const args = message.content.slice(PREFIX.length).trim().split(" ");
Next time you see this kind of error, make sure to check which variable is affected by the undefined issue. ^
For your index.js file, I should replace:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install waterdrop
You can use waterdrop like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the waterdrop component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page