help with making a shooting game

Started by stevo2024, Fri 05/04/2024 01:54:52

Previous topic - Next topic

stevo2024

Hi everyone. I'm new to this so please read on.
I'm making a shooting game and wanted to only shoot a selected part of a character , my  character is a robot and the only way you can kill him is if you shoot a panel on his back.  Is there anyway I can do this ? . I can manage to kill him no matter wear I Shoot him but that is to easy for the game I'm wating to do.
ANY HELP WITH THIS PLEASE.
Thank you.

eri0o

This is the wrong forum board for this, can some moderator move this message?

Also you gave not enough information on how you implemented this so it's hard to figure what you want. You can check for something in a point p being inside of a rectangle rect with something like (p.x > rect.x && p.x < rect.x + rect.width && p.y > rect.y && p.y < rect.y + rect.height), but the how this would work in your case depends. When you say shooting are you scripting a projectile, is this a ray cast or it's just somewhere you click?

Khris

Assuming this is just about clicking the character, you can use the FollowCharacter command:

Code: ags
 // in game_start or room_Load
  cPanel.FollowCharacter(cRobot, FOLLOW_EXACTLY, 0);

cPanel is a second character with walkcycle sprites based on the robots'. The idea is that the panel is not always visible; i.e. the front walkcycle will contain fully transparent sprites, while the back cycle sprites contain just the panel, but have the same dimensions as the robot's so it's always in the right place.

The special FollowCharacter parameters causes the panel character to always be in the exact same position as the robot, so this should work out in theory.

Now all you need is a click handler for the panel character.

stevo2024

HI EVERYONE
I'm new to all this so please any help you can give will be welcome.

I'm making a shooting game. I have a character that you can only kill if you shoot the a target on his back , the gun is just a inventory item that you click on him. My question is , HOW Do I get the gun to shoot only on the target and not on any other part of the character the target is on .

The target is on the back of the character, so when he turns round you can shoot to kill him. But I can't suss out how you can do this.

Thanks for reading my post , and any help you can give will be most welcome.

Gilbert

Just merged both topics. As your original post was already being replied to, please keep the discussion of the same issue in the same thread. Thank you.

SMF spam blocked by CleanTalk