|
| 1 | +init python: |
| 2 | + from renpy.display.image import Image |
| 3 | + from renpy.display.motion import Transform |
| 4 | + import random |
| 5 | + |
| 6 | + class Fish: |
| 7 | + def __init__(self, image_path, x, y, zoom, transform): |
| 8 | + self.image = Image(image_path) |
| 9 | + self.x = x |
| 10 | + self.y = y |
| 11 | + self.zoom = zoom |
| 12 | + self.transform = transform |
| 13 | + |
| 14 | + def get_transform(self): |
| 15 | + return Transform(self.image, xalign=0.0, ypos=self.y, zoom=self.zoom) |
| 16 | + |
| 17 | + |
| 18 | + # Generate multiple fish dynamically |
| 19 | + fish_list = [] |
| 20 | + def spawn_fish(): |
| 21 | + if random.randint(1, 2) == 1: |
| 22 | + img = "Fishing_images/Fish_right.png" |
| 23 | + transform = left_to_right |
| 24 | + else: |
| 25 | + img = "Fishing_images/Fish_left.png" |
| 26 | + transform = right_to_left |
| 27 | + fish_list.append(Fish(img, 0, random.randint(400, 900), 0.5, transform)) |
| 28 | + |
| 29 | +# Transforms for fish |
| 30 | +transform left_to_right: |
| 31 | + xalign -0.2 |
| 32 | + linear 6.0 xalign 1.2 |
| 33 | + |
| 34 | +transform right_to_left: |
| 35 | + xalign 1.2 |
| 36 | + linear 6.0 xalign -0.2 |
| 37 | + |
| 38 | +screen fish_Game: |
| 39 | + frame: |
| 40 | + xsize 1920 |
| 41 | + ysize 1080 |
| 42 | + background "Fishing_images/Fishing_background.jpg" |
| 43 | + if (len(fish_list) < 21): |
| 44 | + timer 2 action Function(spawn_fish) repeat True |
| 45 | + for fish in fish_list: |
| 46 | + add fish.get_transform() at fish_caught |
| 47 | + |
| 48 | + |
| 49 | +screen instructions_Fishing: |
| 50 | + frame: |
| 51 | + xsize 800 |
| 52 | + ysize 700 |
| 53 | + align (0.5, 0.5) |
| 54 | + background "#333333" |
| 55 | + padding (20, 20) |
| 56 | + vbox: |
| 57 | + null height 10 |
| 58 | + spacing 20 |
| 59 | + text "Welcome to the Fishing Game!" color "#FFFFFF" size 40 |
| 60 | + text "Instructions:" color "#FFFFFF" size 30 |
| 61 | + for instruction in [ |
| 62 | + "1. Use your mouse to control the fishing rod.", |
| 63 | + "2. Catch the fish that swim across the screen.", |
| 64 | + "3. Avoid catching non-fish", |
| 65 | + "4. Try to score as many points as you can." |
| 66 | + ]: |
| 67 | + text instruction color "#FFFFFF" size 25 |
| 68 | + null height 20 |
| 69 | + textbutton "Start" action [Show("fish_Game")] |
| 70 | + |
| 71 | + |
| 72 | + |
0 commit comments