Make attraction and shoot action

Hi there,
Since I successfully collided the object each other by setting non-solid.
I want to let the enemy ball moves to player ball until the enemy ball reached to player ball’s position then kill player ball.Whatever the player moves,the enemy ball is attracted by the player.

Assume enemy ball is red ball and player ball is white ball

I have ever tried to use enemy set position to object player,but it’s too fast seems that no movement it does.

Thanks.
Regard.

3 Likes

you want to set enemy behavior to move towards then set object as player

4 Likes

Here’s an example: https://ready.app.link/v6XBPecMH1

The enemy (red) chases the player (white) until they collide, then there is a bang and the player vanishes.

4 Likes

So can you help me this action with the event.
When click shoot button
Shoot a little cyan ball (it is bullet) from the player ball to hurt the enemy ball.

Assume enemy ball full health : 100
Therefore,substract 5 to it health

If holding the screen to trigger the shoot button
The bullet will be repeatedly dispensed until the shoot button no detect.

Therefore,when the bullet frequently shoots to the enemy ball,each bullet hurt it 5 health until enemy ball 's health bar < 0

Due to the fact that I’m confusing about shooting function.

Here’s the design screen and game screen

thanks.

4 Likes

Hi @BlueWhaleYT,

I’m out of time for making demos tonight, but I remembered this earlier thread which will answer a lot of your questions, in particular about shooting:

https://forum.getready.io/t/set-direction-to-variable-bullet-movement/2000/6

3 Likes

I step by step but it doesn’t work.
I just want the bullet dispenses to forward and backward.

4 Likes

Hi @BlueWhaleYT! Here are some things you can do:

  • Add another object to the scene, make it invisible and place it in the player position, for example, let’s name it “Shoot Controller” and we need to constantly turn it towards the enemy:

1)IF

    Shoot Controller/Appearance/Hidden/No 

DO

    Shoot Controller/Appearance/Set Opacity/0
    Shoot Controller/Position/Set Position To Object/Player
    Shoot Controller/Angle/Face To Object/Enemy
  • Create a bullet and add it to the new class “Bullet” and place the bullet to the left of the scene (for example “x= -5” position)
  • We make a shoot:

2)IF

     Shoot Button/Sensing/Touch Down

DO

     Shoot Controller/Clone/Clone Object/Bullet

3)IF

    Any Objects In Class "Bullet"/Position/Right Of Coordinate/ -4

DO

    Affected Objects In Class "Bullet"/Movement/Move Forward In Over Time/3 m
  • We remove the bullet in two ways:

4)IF

    Any Objects In Class "Bullet"/Sensing/Collided With Object/Enemy

DO

    Affected Objects In Class "Bullet"/Clone/Remove Clone
    Enemy Health Bar/Value/Subtract/5

5)IF

    Any Objects In Class "Bullet"/Position/Right Of Coordinate/ 3.5
   OR
    Any Objects In Class "Bullet"/Position/Left Of Coordinate/ -3.5
   OR
    Any Objects In Class "Bullet"/Position/Above Of Coordinate/ 2.5
   OR
    Any Objects In Class "Bullet"/Position/Belove Of Coordinate/ -2.5

DO

    Affected Objects In Class "Bullet"/Clone/Remove Clone
4 Likes

Hi,I did.but why the ball dispenses to the sky.

4 Likes

…What do you mean?

3 Likes

When click shoot button,the player ball shooting to the sky,not shooting forward

and the other thing is the bullet sticky on the same position whatever the player ball moves.

maybe I send a link to you?

4 Likes

Yes, send the link … I can look it later today

3 Likes

https://ready.app.link/QpRcSKz3H1

4 Likes

Good Job! You need just:

  • turn off the “Hidden” parameter for the “Shooting Controller”
  • use “X=-5” position for the Ball
4 Likes

How to let the enemy health bar tracking to enemy ball above.?I don’t want click any button to control it’s tracking.I want the enemy health bar moves if enemy ball is moving.


thanks.

3 Likes

Try using the “join” behaviour to make two objects move together. I believe there’s a tutorial on the “learn” page (or the “learn” tab inside Ready Maker).

4 Likes

Resulting in Move toward is not working,cause enemy health bar needs also?

3 Likes

https://ready.app.link/u1jwZ0KQJ1
@BlueWhaleYT

I made this for you. hope it helps.
Use joytstick/keyboard
Move your ship, tap shoot.
Ship shoots red bullet the direction it’s facing.
When octopus is hit, it’s health bar lowers by 5
When health bar is less than 1, octopus hides.

Look at all behaviours and physics for the sprites, and check to see which are solid on/off.
And check the code used.

4 Likes