Ramdom CPU Player Catch and Movement

Get help using Construct 2

Post » Thu Nov 22, 2012 6:12 pm

In my game I have 2 players, 1 is controlled by a human and the other by the cpu. They throw a bomb back and forth across a line in the middle of the screen,( I plan on randomizing the exploding times of the bomb: 3 to 5 seconds), if the bomb reaches the far edge of the screen, the other side gets an extra player that is attached to the first player and the 2 move in unison.

When one player fills their side(from middle line to screen edge) they win. The extra men that come out will be able to die if that side holds the bomb too long and it explodes, killing the last man that came out. Also, if the player is too far from the line in the middle of the screen the bomb will not clear the line, making it bounce back onto the side of the player that threw it and increasing the chances that it will explode on that side. Kinda like tennis or volleyball.

How would I make sure the CPU player does not cath the bomb before it bounces to the sceens edge everytime? In otherwords: A human player may miss the ball every once in a while. I'm thinking the CPU player may catch it every time. Am I correct in this thinking? And, How would I randomize the CPU player time on holding the bomb?

Thanks for any help.
B
31
S
16
G
11
Posts: 449
Reputation: 9,719

Post » Fri Nov 23, 2012 5:47 am

You could limit the speed of your CPU player. Even if it could perfectly go to the ball every time it just wouldn't make it the the position in time. There has been some discussion about jump landing predictions.. (I can't find the thread), But you could use that idea to move your CPU to where the ball will be instead of where it is at. In that way you can set you CPU to move back to a estimated position the ball will be.

What have you attempted to implement so far?
B
20
S
4
G
2
Posts: 124
Reputation: 2,482

Post » Sat Nov 24, 2012 3:41 pm

Umm, nothing.

Long story short: I was creating a sprite for a different game, when I was browsing for examples this idea came to mind for a new take on breakout. I just finished the background and sprites when I started to have different ideas about the game and how to implement it.

So, in general: I have a desert background, a road that spans left and right at the screen bottom. A guard tower centered on the road with a short wall dividing the sides. A tall barracks building on each of the far edges of the screen with a flag atop the barracks. There will be 2 tanks on either side of the wall. Each tank (1 controlled by a human and the other by cpu) will attempt to destroy the others barracks. Kinda like breakout.

I just created each object- background, road, tower, wall and tanks. I did the beginners tutorial (ghost shooter) but finding it hard to find the correct events/ actions to control the tank. When I move forward the tank goes off screen. I tried bound to but it didn't work. When I reverse, the tank flips upside down. And I can move up & down. Which I only need to move left and right. Dont' know if it's correct but, I wanted to start with getting the tank moving in the right directions. Also, the tank drives behind the tower.

I tried looking through the manual, no help there.

B
31
S
16
G
11
Posts: 449
Reputation: 9,719


Return to How do I....?

Who is online

Users browsing this forum: armaldio, plinkie and 18 guests