Wish to Fix Wendy's Shooting Game, can I have help?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Kyren
Newbie
Posts: 12
Joined: Thu Mar 07, 2024 3:36 pm
Contact:

Wish to Fix Wendy's Shooting Game, can I have help?

#1 Post by Kyren »

Hello, I am on my way to make my own game, I am currently using the Shooting Game Plugin by Wendy!
Because this is a very new territory for me, I have no idea how to fix it. At the moment, when time is up, you lose all of your life, and even if time is up, you can't shoot again. Once you shoot, you will also receive a game over.

The goal of this is to ensure that you lose one life each time you shoot until it is truly game over, with zero lives and zero bullets remaining.

Only thing I have done is fix a way to jump to a game over or win screen

https://github.com/Wendy-Nam/RenPy-Shoo ... /tree/main

The Win/Game Over thing I coded, everything else is in the link.

Code: Select all

    if hunt.status.is_game_over():
    # Check if the player won or lost
        if hunt.status.life_now <= 0:
        # Player lost
            jump game_over
        else:
        # Player won
            jump win
Last edited by Kyren on Tue Mar 12, 2024 11:04 am, edited 2 times in total.

Kyren
Newbie
Posts: 12
Joined: Thu Mar 07, 2024 3:36 pm
Contact:

Re: Wish to Fix Wendy's Shooting Game, can I have help?

#2 Post by Kyren »

UPDATE:

I fixed the health issue but now the issue I bumped into is the game still thinks it is Game Over once you're at 0 life. Pretty much once you are at 0 life and shoot a bullet you end up in a game over screen. Here are some updated codes

Code: Select all

            if self.status.is_time_up():
                    if self.status.bullet_now <= 0 or self.status.life_now <= 0:
                        self.round_end("TIME'S UP", True)
                    else:
                        self.status.time_left = self.config.time_limit
                        self.status.life_now -= 1
                        renpy.say(who=None, what="TIME IS UP!", interact=True)
                        return

Code: Select all

            def is_game_over(self):
                # Check if the game is over
                if self.time_left == 0:
                        if self.bullet_now <= 0 and self.round_now <= self.round_nb:
                            return True
                if self.time_left > 0 and self.life_now <= 0:
                    return True
                return False
EDIT: This works fine, just idk how the game can tell if the life is 0 it is game over. I guess I will go with it this unless there are someone that knows how to fix it

Kyren
Newbie
Posts: 12
Joined: Thu Mar 07, 2024 3:36 pm
Contact:

Re: Wish to Fix Wendy's Shooting Game, can I have help?

#3 Post by Kyren »

Kyren wrote: Tue Mar 12, 2024 8:51 am UPDATE:

I fixed the health issue but now the issue I bumped into is the game still thinks it is Game Over once you're at 0 life. Pretty much once you are at 0 life and shoot a bullet you end up in a game over screen. Here are some updated codes

Code: Select all

            if self.status.is_time_up():
                    if self.status.bullet_now <= 0 or self.status.life_now <= 0:
                        self.round_end("TIME'S UP", True)
                    else:
                        self.status.time_left = self.config.time_limit
                        self.status.life_now -= 1
                        renpy.say(who=None, what="TIME IS UP!", interact=True)
                        return

Code: Select all

            def is_game_over(self):
                # Check if the game is over
                if self.time_left == 0:
                        if self.bullet_now <= 0 and self.round_now <= self.round_nb:
                            return True
                if self.time_left > 0 and self.life_now <= 0:
                    return True
                return False
EDIT: This works fine, just idk how the game can tell if the life is 0 it is game over. I guess I will go with it this unless there are someone that knows how to fix it
UPDATE! For some reason once bullet hits 0 it doesn't give game over for some reason.

Code: Select all

        def handle_events(self):
            # Handle various game events
            if self.status.is_game_over():
                self.round_end("GAME OVER", True)
                return
            if self.status.is_clear():
                self.round_end("clear")
                return
            if self.status.is_time_up():
                    #if self.status.bullet_now <= 0 or self.status.life_now <= 0:
                    if self.status.bullet_now <= 0:
                        self.round_end("Out of bullets", True)
                    elif self.status.life_now <= 0:
                        self.round_end("TIME'S UP", True)
                    else:
                        self.status.time_left = self.config.time_limit
                        self.status.life_now -= 1
                        renpy.say(who=None, what="TIME IS UP!", interact=True)
                        return

Code: Select all

            def is_game_over(self):
                # Check if the game is over
                if self.time_left == 0:
                        if self.bullet_now <= 0 and self.round_now <= self.round_nb:
                            return True
                if self.time_left > 0 and self.life_now <= 0:
                    return True
                return False

Code: Select all

def attack(self, status, targets):
    # Perform player attack and hit detection
    renpy.call_screen("gun")
    self.hit_pos = [renpy.get_mouse_pos()[0], renpy.get_mouse_pos()[1]]
    for i in range(self.config.target_nb):
        if not targets[i].killed:
            pos = targets[i].get_pos()
            if self.is_hit(pos, targets[i].image_size):
                targets[i].hide()
                targets[i].killed = True
                status.target_now -= 1
    renpy.with_statement(vpunch)
    if self.fired and status.bullet_now > 0:  # Check if the player fires and has bullets left
        status.bullet_now -= 1  # Only decrement bullet count if the player fires and has bullets
        self.fired = False
    return None
Last edited by Kyren on Tue Mar 12, 2024 3:52 pm, edited 1 time in total.

jeffster
Veteran
Posts: 409
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Wish to Fix Wendy's Shooting Game, can I have help?

#4 Post by jeffster »

Kyren wrote: Tue Mar 12, 2024 8:51 am

Code: Select all

            def is_game_over(self):
                # Check if the game is over
                if self.time_left == 0:
                        if self.bullet_now <= 0 and self.round_now <= self.round_nb:
                            return True
                if self.time_left > 0 and self.life_now <= 0:
                    return True
                return False
EDIT: This works fine, just idk how the game can tell if the life is 0 it is game over. I guess I will go with it this unless there are someone that knows how to fix it
Function is_game_over() returns True if game over, and False if game is not over.

To add extra lives, you can modify this part

Code: Select all

                if self.time_left > 0 and self.life_now <= 0:
                    return True
like this:

Code: Select all

                if self.time_left > 0 and self.life_now <= 0:
                    self.lives -= 1
                    if self.lives <= 0:
                        return True
if you keep the amount of lives in self.lives.

Kyren
Newbie
Posts: 12
Joined: Thu Mar 07, 2024 3:36 pm
Contact:

Re: Wish to Fix Wendy's Shooting Game, can I have help?

#5 Post by Kyren »

jeffster wrote: Tue Mar 12, 2024 1:11 pm
Kyren wrote: Tue Mar 12, 2024 8:51 am

Code: Select all

            def is_game_over(self):
                # Check if the game is over
                if self.time_left == 0:
                        if self.bullet_now <= 0 and self.round_now <= self.round_nb:
                            return True
                if self.time_left > 0 and self.life_now <= 0:
                    return True
                return False
EDIT: This works fine, just idk how the game can tell if the life is 0 it is game over. I guess I will go with it this unless there are someone that knows how to fix it
Function is_game_over() returns True if game over, and False if game is not over.

To add extra lives, you can modify this part

Code: Select all

                if self.time_left > 0 and self.life_now <= 0:
                    return True
like this:

Code: Select all

                if self.time_left > 0 and self.life_now <= 0:
                    self.lives -= 1
                    if self.lives <= 0:
                        return True
if you keep the amount of lives in self.lives.
What I did instead for -1 life was this:

Code: Select all

        def handle_events(self):
            # Handle various game events
            if self.status.is_game_over():
                self.round_end("GAME OVER", True)
                return
            if self.status.is_clear():
                self.round_end("clear")
                return
            if self.status.is_time_up():
                    #if self.status.bullet_now <= 0 or self.status.life_now <= 0:
                    if self.status.bullet_now <= 0:
                        self.round_end("Out of bullets", True)
                    elif self.status.life_now <= 0:
                        self.round_end("TIME'S UP", True)
                    else:
                        self.status.time_left = self.config.time_limit
                        self.status.life_now -= 1
                        renpy.say(who=None, what="TIME IS UP!", interact=True)
                        return

jeffster
Veteran
Posts: 409
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: Wish to Fix Wendy's Shooting Game, can I have help?

#6 Post by jeffster »

I don't understand why the amount of lives is processed only in

Code: Select all

if self.status.is_time_up():
but if it works, fine.

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot], Milkymalk, wizard_jpg