GithubHelp home page GithubHelp logo

spelunking-studios / the-caverns Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 146.25 MB

An exploration ARPG game made in python with pygame

Python 99.54% Batchfile 0.21% Nix 0.25%
game pygame python python3

the-caverns's People

Contributors

https123456789 avatar lggamelab avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

lggamelab

the-caverns's Issues

Bat can get stuck on walls and rocks

Expected Behavior

When path finding toward a target, the bat should move toward the target while not stopping.

Experienced Behavior

When path finding toward a target, the bat will usually move to the target no problem. However, if there is an obstruction to the straight line between the bat and the target, the bat will simply get stuck.

Rats pile on top of player and don't deal damage

Expected Behavior

When the rat hits the player, it should attack the player but fall back after each attack.

Experienced Behavior

When the rat attacks, it deals the damage, and continues forward. It ends up getting stuck on top of the player and doesn't deal any more damage.

Add re-sizable windows?

It would be nice to have re-sizable windows. This should be a low priority, but if I get bored or tired, I might work on this a bit.

Memory leak in the Animation class

Background

The base Enemy class (enemies/enemy.py) has an animation property of type Animation (animations.py). Every time the enemy takes damage, the base class's takeDamage method is called:

https://github.com/LGgameLAB/The-Caverns/blob/91292b606e94e1b1aacf148080e8d71e44a3379d/enemies/enemy.py#L91-L95

The important part is line 93 which calls the fx method of the Animation class and passes it a new HurtFx object. Looking at the Animation class' fx method, all it does is add the object passed to it to its imageEffects property:

https://github.com/LGgameLAB/The-Caverns/blob/91292b606e94e1b1aacf148080e8d71e44a3379d/animations.py#L106-L108

After looking through both the Animation and HurtFx class, there is no method of freeing the memory, and the list of effects can become filled with effects that are not active. The way the game handles effects that are "over" is by determining if the current time minus the start time is past the "duration" of the effect. If it is in fact "over", the image effect is not drawn. To prevent future calls to the now "over" effect, the method calls its kill method, removing itself from any groups it belonged to, and preventing the game from finding it and calling it. Visually, this works fine, but one major problem exists.

The Problem

The issue here is that even though the effect removes itself from any groups, it still persists in memory as the kill method does not actually free the object. As the pygame documentation states:

The Sprite is removed from all the Groups that contain it. This won't change anything about the state of the Sprite. It is possible to continue to use the Sprite after this method has been called, including adding it to Groups.

(Note: emphasis is made by me and not the docs)

This means that the imageEffects list on the Animation object will retain all of the effects that have ever occured.

Solution

To solve this, would require simply adding a method to the Animation class that will delete its name reference to the HurtFx object. Since no name references should be left, the object can be garbage collected by python.

Bat disappears after hitting the player and then reaching the pivot point

Expected Behavior

The bat should move towards the player until it hits the player. Once it has hit the player, the bat should then move towards a random point away from the player (this is called the pivot point). Once it has reached the pivot point, the bat should turn around and once again move towards the player.

Experienced Behavior

The bat successfully moves towards the player, attacks the player, and moves to the pivot point. The bug arises when the bat should be moving back toward the player. For some reason, the doesn't move back towards the player. Instead, it just disappears.

Change cursor to reflect UI component states

This would mean that when a UI component (lets say a Button) has a particular state activated, the system cursor will be updated to reflect the state. For example, when a Button component has the hover or clicked state, the system cursor should be a pointer and upon being unhovered or unclicked, the cursor will return to the system default. This is not a high priority, as it is purely ascetics, but it shouldn't be hard to implement. @LGgameLAB what are your thoughts?

Add serialization for inventories

Add a set of methods to the inventory system API for serialization of a item registry.

Ideas

For serializing:

def serialize(self) -> String

And then to deserialize:

def deserialize(self, source: String) -> Inventory

This is planned to done (see this comment), but I wanted to make an issue to sort of remind me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.