🎣 The Magic Fish Bowl: Give Players Power-Ups!
Tutorial beginner compiles

🎣 The Magic Fish Bowl: Give Players Power-Ups!

Updated beginner Code verified

🎣 The Magic Fish Bowl: Give Players Power-Ups!

Welcome, young game maker! Today, we are going to make a cool fishing game. You will learn how to give players special fish items. These fish give health or shields. It is like giving a player a magic potion!

What You'll Learn

  • What Fish Items are in Fortnite.
  • How to use a Prop Mover device.
  • How to write simple Verse code.
  • How to make fish appear when a player clicks a button.

How It Works

Imagine you have a big bowl of magic fish. When a player eats a fish, they get stronger! In Fortnite Creative, we have special items called Fish Items. They are like power-ups.

There are many types of fish. Some give health. Some give shields. Some give speed! We will use a device called a Prop Mover. Think of it like a magic tray. You put a fish on the tray. Then, you press a button. The tray flies to the player. The player gets the fish!

We will use Verse to make this happen. Verse is the language we use to tell the game what to do. We will write a script that says: "When the player clicks, send the fish to them."

Let's Build It

First, open your Fortnite Creative island. Go to the Devices tab. Search for Prop Mover. Drag one onto your island.

Now, we need a fish. Go to the Items tab. Search for Slurpfish. Drag it into your island. Place it on the Prop Mover.

Now, let's write some Verse code! This code makes the fish fly to the player.

# This is our main script file.
# It controls the magic fish bowl.

using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is our device class.
# It holds the fish and moves it.
magic_fish_bowl := class(creative_device):

    # This is our Prop Mover device.
    # Connect it in the editor by selecting your PropMoverDevice.
    @editable
    MyPropMover : prop_mover_device = prop_mover_device{}

    # This is our Item Granter device.
    # It gives the fish item to the player.
    # Note: item_granter_device is the real API for handing items to players.
    @editable
    MyItemGranter : item_granter_device = item_granter_device{}

    # This is our Button device.
    # The player clicks it to get a fish.
    @editable
    MyButton : button_device = button_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # Tell the Button to call OnButtonPressed when clicked.
        # We will tell it when to move later.
        Print("The fish bowl is ready!")
        MyButton.InteractedWithEvent.Subscribe(OnButtonPressed)

    # This function runs when the player clicks the button.
    # We call this an "Event".
    OnButtonPressed(Agent : agent) : void =
        # Check if the player clicked us.
        # If yes, send the fish!
        Print("Sending the magic fish!")

        # This line tells the Item Granter to give the fish.
        # The item to grant is set on the item_granter_device in the editor.
        # Note: Set the item to "Slurpfish" on MyItemGranter in the editor UI.
        MyItemGranter.GrantItem(Agent)

        # This line tells the Prop Mover to move.
        # It moves toward the player's position.
        MyPropMover.Begin()```

### Walkthrough of the Code

1.  `using { /Fortnite.com/Devices }`: This tells Verse we want to use devices.
2.  `magic_fish_bowl := class(creative_device)`: We create our own device class that the game can run.
3.  `@editable`: This lets us connect real devices from the editor, like snapping puzzle pieces together.
4.  `OnBegin<override>()<suspends>`: This runs when the game starts. It prints a message and listens for button clicks.
5.  `MyButton.InteractedWithEvent.Subscribe(OnButtonPressed)`: This wires the button so that when clicked, our function runs.
6.  `MyItemGranter.GrantItem(Player)`: This gives the fish to the player! Set the item to **Slurpfish** on the `item_granter_device` in the editor.
7.  `MyPropMover.Move()`: This tells the Prop Mover to animate, so the fish visually flies toward the player.

## Try It Yourself

Now it is your turn! Can you make a **Shield Fish** instead of a Slurpfish?

**Hint:** Look at the `GrantItem` line in the code. In the editor, find your `MyItemGranter` device and change its item setting from `Slurpfish` to `Shield Fish`. Save your code and play your island!

## Recap

You built a magic fish bowl! You used a Prop Mover device. You wrote Verse code to give items to players. You can now make any fish item appear with a click. Great job, coder!

## References

*   https://dev.epicgames.com/documentation/en-us/fortnite/using-fish-items-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite/using-fishing-items-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-fish-consumables-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-items-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite/using-items-in-fortnite-creative

Verse source files

Turn this into a guided course

Add using-fish-items-in-fortnite-creative to your free study plan β€” we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.

Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.

Comments

    Sign in to vote, comment, or suggest an edit. Sign in