# How do I make a bullet more accurate?

Get help using Construct 2

### » Tue May 06, 2014 3:35 pm

@blackhornet you are absolutely right!

@moymoymoy i'll send you the file... Thanks to blackhornet it works
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

### » Wed May 07, 2014 1:02 pm

Thank you both for helping and coming up with a solution

Im sorry to appear dense however, but is there a chance this could be explained in simpler terms? Ive had a looked at the new capx and i understand the event/actions that are happening but i dont quite get how the difference is made.
B
11
S
2
G
1
Posts: 62
Reputation: 1,410

### » Wed May 07, 2014 3:11 pm

It's a bit of a tricky concept, but run the example included. You'll see three squares. The red and yellow are on the same layer (0), blue is on a different layer (1) with parallax of 50,50. The coordinates of each are displayed at the bottom. Use the arrow keys to move the red square.

If you move the red square a little bit, only the Red coordinates change, as you'd expect. But as you move further right or down, you'll see two things on the Blue coordinates. The first pair never move, as there is no movement being applied to the blue square, but clearly the blue square is moving on the screen. That's because the parallax calculation is coming into play and making the layer that Blue is on appear to move. The second coordinates are the coordinates of the blue square according to layer 0. They move, as they are showing the location of the blue square according to layer 0.

When you need to calculate locations between two layers, you need to account for this. That is what the CanvasToLayer and LayerToCanvas expressions help with. You convert from the layer to the canvas, which is the global coordinate system, and then back to the layer you care about.
You do not have the required permissions to view the files attached to this post.
B
71
S
22
G
274
Posts: 3,826
Reputation: 151,295

Previous