How do I shoot left?

Get help using Construct 2

Post » Thu Nov 22, 2012 3:54 am

I am making a platform game where the player has a gun but I don't know how to make him shoot to the left. How do I do this?
B
1
Posts: 3
Reputation: 331

Post » Thu Nov 22, 2012 5:04 am

bullet- set angle of motion- 180
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Thu Nov 22, 2012 6:32 am

I'd give the player a variable called Facing Direction and use Joannesalfas suggestion too.

If Left is pressed, set Facing Direction to Left
If Right is pressed, set Facing Direction to Right

If SPACE is pressed
     FacingDirection = Left, set bullet angle of motion to 180
     FacingDirection = Right, set bullet angle of motion to 0

If you want I can make a .capx for you too
Using R238 for all examples
B
60
S
17
G
6
Posts: 363
Reputation: 9,125

Post » Fri Nov 23, 2012 12:15 am

hi,
im new on construct 2 and i have the same problem.i tried your suggestion but can't figured out.here is a link of my capx can you please help?
http://dl.dropbox.com/u/8046259/eskiz.capx

thanks
B
5
Posts: 11
Reputation: 822

Post » Fri Nov 23, 2012 5:25 am



Muratcizer,

First thing I see here is that you have an event with completely contradicting actions. This makes your B button not work at all at the moment.

You can't throw all your bullet angles into the same event. You need to break it up into at least two separate events.

There is a bit of work that needs to go into this. I would suggest going over the manual at least once.

Your bullets should spawn on a layer other than your background. Move them to layer 1.

You are being redundant calling out the imagepoint for adam. When you have Adam spawning the bullet and it prompts you for which image point it spawns on, you are directly telling it which image point on adam it is being placed. Just put 1.

Also, for some reason you image point appear misaligned for whatever reason. As you move up on the plateforms the point relative to your sprite adam also goes up. As you move right the spawn point moves further right. There appears to be some major bugs going on that I can't seem to figure out.

Also, you have a memory leak by creating an endless supply of bad guys every 2 seconds that move left and are not destroyed under any condition when they move off screen. You'll want to address that. the same goes with the bullets.


TL;DR by seperating your current statement to spawn a bullet into two different events, it would shoot perfectly left or right depending on which way he was facing.


Good luck getting the rest of the bugs sorted.IsometricRobot2012-11-23 05:27:39
B
20
S
4
G
2
Posts: 124
Reputation: 2,482

Post » Fri Nov 23, 2012 5:56 am

Figured out why your spawn point for your bullets was moving all funny. You resized your main sprite after creating it. The game information for that sprite does not match what you have currently sized on your layout. When firing its attempting to spawn at imagepoint 1 where your full sized sprite would be.

Resize the sprite in the editor, or through another program like paint or photoshop, and this should be fixed.

There are so many reasons other than this strange bug to not manually resize an image on the layout (pixelilation of graphic alone should make you shy away from this method).IsometricRobot2012-11-23 05:57:01
B
20
S
4
G
2
Posts: 124
Reputation: 2,482

Post » Fri Nov 23, 2012 9:38 am

many thanks.You points are usefull.i learned so much.i will try your suggestions.

sorry for my poor english.
B
5
Posts: 11
Reputation: 822


Return to How do I....?

Who is online

Users browsing this forum: GSquadron and 27 guests