Top Down Shooter Problem

Just started using Construct 2? Post your questions here

Post » Sun Apr 05, 2015 9:57 am

Message: LittleRyuk can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
I am having problems with my shooting mechanic. Players are able to aim and shoot to the position of where the mouse is located which is what i want. However I want to be able to shoot only in the direction the character is facing. In the capx i have provided you can shoot anywhere regardless of where the character is facing.

Cheers.

https://drive.google.com/file/d/0B1-VQo5DI8SKdEZiVTFEMmQyQkk/view?usp=sharing
B
5
Posts: 6
Reputation: 331


Post » Sun Apr 05, 2015 2:59 pm

@Lordshiva1948: Your link doesn't work and doesn't allow anyone to see the demos you are referring to.
You can't share a folder like that with dropbox, but rather public links to specific files.

@LittleRyuk: In the event where you get your attack going (your capx is so messy, I'm sorry, I can't pinpoint a single event, I'll leave the implementation up to you) add conditions that check the direction of your character and the mouse position (expressions mouse.X and mouse.Y).

This way, when the character is facing left, but that mouse.X is greater than character.X you know you shouldn't allow the shoot to go.
Implement it for all four directions (likely as subevent) and you're good to go.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
276
S
103
G
84
Posts: 7,289
Reputation: 83,098


Post » Mon Apr 06, 2015 12:35 am

Awesome i shall give that a go Kyatric. i'll let you know how it went.

I do appreciate your help, it had me stuck for quite a while. I will work on keeping the code neater in future.

Thanks again.
B
5
Posts: 6
Reputation: 331

Post » Mon Apr 06, 2015 1:18 am

Kyatric, i got it working! TY
B
5
Posts: 6
Reputation: 331


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest