AGARIO RACE (With Advanced AI for detecting closest sprite)

https://ready.app.link/TPHQd6SkuI

I made this a while back.
The Green Monster always move towards the nearest blue pellet.
A circle sprite is always at the Monsters position.
The circle grows in size continously.
When the circle touches a pellet, the Monster sets its angle towards that pellet.
The circle sets size to small when it touches a pellet.
Since there’s no way to use maths to measure the distance of each pellet to the monster, i used this technique to detect the closest pellet.
When a pellet touches the Monster or players sprite, that pellet instantly sets position to a random location that can be anywhere onscreen.
For any interested, they can check the code to see how this was done

6 Likes

This really cool game and logic, thanks @Suzzy-Grey
:+1::+1::+1:

2 Likes

@Suzzy-Grey very interestingly, how did you implement the random generation of objects?

2 Likes

If you make the “Heart” sprite visible, you’ll see that it uses the “Wrap around” behaviour.
The heart moves super fast from the screens top to the screens bottom and left to right.
So the Heart’s moving in a diagonal motion. The Heart pretty much has occupied every space on the screen in a few seconds as it quickly moves. A Pellet sets position to the Hearts position when its touched by the player or NPC. So no clones are being created or destroyed. Only the position of the existing pellets change during the game.

2 Likes

Thanks @Suzzy-Grey, i think this is an excellent option for randomly generating objects. I also want to share one more way, which significantly offloads the project when the scene loading.

  1. Create Border in the your scene.
    2)Add the Spawn Controller.
    3)Add the “Bullet” behavior for the “Spawn Controller” object, adjust the speed, turn on “Bounce” parameter and adjust the “Flow Direction” parameter.
    4)Add the “Point” object, which we will clone.
    5)Create the new class “Points” for the “Point” object.
    Example:

Disable the visibility of the “Spawn Controller” object when the scene starts:

Сloning the new objects with the necessary periodicity (Due to the fact that our object “Spawn Controller” randomly moves around the scene, we get the generation of the object in a random place.)

Improve performance - remove objects that are long on the scene:

4 Likes

Creative way of detecting closest pellet. I got beat by 30 points.

2 Likes

The game runs 4 times faster on the PC than on the Ipad.
As a result, the NPC moves a bit too fast on the PC and runs off screen a bit and isn’t as accurate as it is on the Ipad.

Thanks for playing :slight_smile:

1 Like

I love this game. I think you should publish it out to the App Store- do you know about the unity exporter that’s now built in? Separately- on the web version I find that I cannot eat pellets that are at the far top or far bottom of the screen. Like an invisible wall stops me from moving further. do you experience the same thing?

3 Likes

Thanks, but i purchased Construct 2 a while back and find it easy to use for making 2D games.

I’ll try remixing that game and remove the '“Padding” i added to the players sprite to stop it running off screen and add “Wrap around” so the players sprite can move to a screens edge and appear on the opposite side of the screen.

Also, when i first used “Padding”, i noticed it’s only accurate as long as the screen isn’t zoomed in or out in the editor. The “Padding” seems like a wire frame rectangle that gets bigger/smaller when zooming in/out with the editor.

You can try the “Padding” for yourself and zoom in/out in the editor and see problem.

This could be fixed by having the “Padding” wrap around the screens edges regardless if the scene is zoomed in or out.

1 Like

Ok great! Btw- have you published out any games from Construct 2 to mobile?

2 Likes

No.
I haven’t published a mobile game.
I can publish a PC game to the Scirra Arcade and a game will be playable on modern mobile HTML5 supported browsers.( as long as there’s just taps/clicks of sprites)
The Safari browser on Ipad doesn’t support HTML5 as good as Chrome
I have no experience publishing a mobile game (ios/apk) though it’s possible with Construct 2

1 Like

@davidsol
Is your company READY about to shut down because you aren’t making a profit?
There’s been no talk of updates to the app and no replies from @Ready

2 Likes

The funny this there is that @Ready visits this forum 2-3 times a week, and reads the new topics and reply’s, yet never responds to anything. I wonder what is going on.

2 Likes

This is so unusual that almost everyone suddenly disappeared from the forum :confused: :confused:

1 Like

It certainly is!

It’s really odd, I wonder if something happened at Ready or something.

2 Likes

So what’s happening with the Ready maker app and this forum?
Can you please at least make an update to the app so it can be fully used offline before it disappears from the app stores?

1 Like