help with a short shooter idea

Started by Icey, Wed 16/01/2013 04:30:02

Previous topic - Next topic

Icey

I know I'm gonna get flagged for this hard body but I gotta fight my fear and ask the question. I've put some thought into this from awhile and I really don't know how to engage. Now I have searched around the forums for help with what I need but everything so scattered and hard to understand cause it focuses more on what they need like bees and zombies and stuff. Now all I would like is if someone could break it down to me as simple as possible. It's something I really wanna know could cause what I learn from this could help me with a lot of other things.

Now I already have a system in mind, it's just going about coding it that's the difficult part. 

[Before I start let me say that a bit of the system idea came from the game Parasite Eve cause it motivated me to try make a similar battle system cause it was so simple and when playing the game I felt I could pull something like it off in AGS.]

1. Player taking damage
I know how to make the player lose HP and stuff it's just I would like to know how do I have enemies walk to X,Y then have them try to attack the player. Enemies have a charge bar so when it re fills they will repeat and try to move to X,Y and attack again.

2. The blast zone
[In parasite eve, when the player would go for an attack the battle would pause and a grid dome would come up, Any target within the Dome can be attacked.]
In the game you have a small shooting range zone that I called "Blast Zone" that is following under the player character(like a mat). If an enemy on of the rings in the zone they can be attacked. The closer the more damage they take but if you get hit the more damage you take.

I'm having trouble figuring out how to make AGS read where the target is, like I have the ring colors separated into individual Objects. I have a (X,Y)check gui. It should tell me if the target is on Ring 1(outer ring) or ring 2(middle ring). The coordinates shouldn't matter so long as the enemy walks over the ring which should just be it's (X,Y). But it doesn't work. Maybe cause I have tried to have the enemy walk over it rather instead I just had the player walk near the enemy thinking it would work the same way. Which I hope it does and I'm just doing something else wrong.


[Here's a test shot example from the in game]



1. Row 1
Normal attack/damage taken.

2. Row 2
Dish out +damage but also take greater damage.

3. Target/enemy
The target can not be selected unless it is over the X,Y of one of the 2 rows.

4. Battle box
A simple action box pops up once selecting the near by target. It displays the HP of the target at the bottom (Tar. 100) and at the top, you can choose how many times you shoot. Depending on the Gun. The pistol is the main gun, you have 16 bullets in the chamber. You can shoot 3, 2, or 1 bullet(s) in your turn.


Please don't flag me down for this, I just really wanna know how to do this so I could get a better understanding at what I'm working with in the future. I'm sure there's a simple way to break this down.

Khris

#1
I'll focus on determining which zone the player is inside.
There are two ways to do this: the first is using Room objects and Object.GetAtScreenXY(). The latter uses pixel-perfect detection and thus will be suitable fine for this.
Since you'd have to create those objects in every room though, characters are a much smarter choice. You haven't posted any code, but here's how simple it is:
Code: ags
// rep_ex_always

  // position Rings
  cInnerRing.x = player.x;
  cInnerRing.y = player.y + 7;
  cOuterRing.x = player.x;
  cOuterRing.y = player.y + 13;

  // enemy loop
    Character*c = Character.GetAtScreenXY(enemy.x, enemy.y + 1);  // +1, otherwise we get enemy itself
    if (c == innerRing) ....
    if (c == outerRing) ...


The other method is using math, calculating the distance.
Code: ags
int Ring(Character* this) {
  if (this.Room != player.Room) return 0;
  int dx = this.x - player.x;
  int dy = (this.y - player.y) * 5; // transform coordinate into topview, where circle is actual circle, not squashed
  int d = dx*dx + dy*dy;
  if (d <= 34*34) return 1;  // inner ring
  if (d <= 80*80) return 2; // outer ring
  return 0; // outside rings
}

// usage:
  if (cEnemy.Ring() == 1) ...
  if (cEnemy.Ring() == 2) ...

Icey

Ok I see. I couldn't figure out which would be better to work with(char, obj). I wanted to try and have it where the battles take place in the same room but it my be best to just move the play to a new room with the same background and stuff and work from there. I first had it set up like this in the room script.
Code: AGS

function room_RepExec()
{
object[0].SetPosition(HERO.x-80, HERO.y+15);//Outer ring
object[2].SetPosition(HERO.x-80, HERO.y+15);//Inner ring(both have the same sprite size so that why the x,y's are the same.

//object[1] is the target
//This was merely a test below to see if AGS noticed where the enemy was. At first I thought it wasn't gonna work cause both Blast zones where set at Baseline = 1; so it can seem like it really is underneath the player and the target that moves over it.

if(object[1].X == object[0].X){
if(object[1].Y == object[0].Y){
Label12.Text = "enemy on row 2";

}
}
if(object[1].X == object[2].X){
if(object[1].Y == object[2].Y){
Label12.Text = "enemy on row 1";

}
}

//What's really supposed to happen is that code above was planed to be placed in the object interaction function. The Targets HP would be displayed in the Battle Box and you would have the option to shoot it. However a else check would run and if the Target's not in one of the 2 rings/rows then nothing would happen or a buzzer sound would play.

}


I think I'll go with the first method cause it looks easy, not saying this process looks easy but it looks like something I'll be able to follow through to the end rather then math. :)

SMF spam blocked by CleanTalk