Fishing minigame random behaviours (solved)

Working on my game (Again) and want to implement a “fishing” minigame. Not in the sense you have to wait for like bubbles and pull at the right moment or something like Stardew valley. I have it so when the player approaches the pond, they get teleported to another screen where they now control a fishing hook, and instead of the 2d side scroller it is like a bird’s eye (I don’t know the term but you control all of wasd and can go up and down instead of just left right jump if that makes sense)
I want the player to have to chase after the fish sprite which is moving erratically across the screen (or away from the player itself but randomly seems easier). Does anyone have any tips for making a random movement behavior like this?
For ref, this is what the player’s screen would look like:


You being the hook, and you have to collide with the fish. I tried using a random that was 1-4 and it varied from north east, southwest, etc… with diff velocities. But it didn’t work and I couldn’t find a way to make it so it wouldn’t get suck in the corners. Currently trying out some raycasts also!

2 Likes

Okay i made something, passable but I would love to refine it more and make it more difficult! He kinda just bounces off the walls now in a fixed pattern(I think at least).

https://flowlab.io/game/play/1653402
^^ Link is here in edit its the last level that says testing fish! I would upload a vid but that took me like an hour last time.

Edit: Here’s a progress screenshot, its not perfect but I improved it a bit


I added the in-between directions so it would add more difficulty! Since ray casts are a small part of a direction its not perfect but It works okay and i think it adds a bigger challenge. :slight_smile:

Edit again:It stopped working now and I didnt even change anything :upside_down_face: now it wont move both left/rigtht and up/down at the same time!! Idk what happened

1 Like

Currently still having an issue with the fish only moving one direction instead of both in the y direction and the x direction! If anyone knows how to fix this let me know :slight_smile:

1 Like

You should change the X velocity to on the X instead of the forward, then have numbers connecting from the flip and back to change it :upside_down_face:

Also, really cool game. With a few problems. The background takes a while to repeat. I found this problem with my game Default. If you aren’t going to put anything in your BG, just put it dead center in the BG layer, and set your player’s camera parallax to 0, so that the BG doesn’t move. Also, I will provide a quote from me explaining how to make a good cloud, since yours look a little drab, no offense :upside_down_face:

Otherwise, pretty cool game. I can tell you have used multiple complex mechanics for this, and I hope to see more from it in the future. Also, you might want to find a way to reduce your object amount (that’s within the library).

2 Likes

That’s how to clod, ladies and gentlemen :sunglasses:

2 Likes

Your finished cloud should look a little like this:
pixil-frame-0 (21)
I can also provide pictures with the tutorial if you like :slight_smile:

1 Like

This is not a “perfect” solution, but it’s mostly functional in my fish game.

a

You can of course adjust your own speeds and timers as you see fit. :slightly_smiling_face:

3 Likes

Coowool :slight_smile:

4 Likes

That worked!! Probably for the best anyway I was trying to cheat out on some code by just using the forward but it was a simple fix! I also switched the BG and put parallax to 0 and it fixed itself. Thanks for that tip too I was just hoping it’d magic itself right eventually because I had the BG repeating on but it wasn’t working.

For the clouds I can definitely look into fixing them. Im not our game’s artist (Im working on this with 2 other people)! and have kinda left a lot of the art as placeholders so I can mess around with them! :laughing: I showed the rest of my team and they loved the instructions! This game is our senior project and will be done by June 2nd! I hope to post the finished product here so everyone can see :slight_smile:

3 Likes

and make it so that there is a random number generator hooked into a clock that generates a random number every second or something and then you can have a filter or something where if the random number follows some rule it flips the fish sending it in the other direction

4 Likes

Was a simplistic design just for a random NPC. Was the shortest bit of code I could come up with to make an NPC move somewhat randomly. I know it’s amateur, but it works if you’re looking for something quick and simple. :slightly_smiling_face:

1 Like