Issue with setting bullet angle of motion

Get help using Construct 2

Post » Wed Jul 03, 2013 12:20 pm

In order to learn the ways of Construct I've been working on remaking the game I worked on at the Global Game Jam back in January. The basic idea behind the game is that you're competing medical dudes playing defib golf with heart attack prone patients.
Here's the capx:
The defib mechanic is at event #30. Controls are WASD to move and space (hold) to defib. Note that I'm using the full version of Construct.
Learning Construct has been great so far but recently I've run into an issue with setting the bullet angle of motion on the NPCs; roughly half of the time player 1 shocks an NPC (sending them flying) the NPC will go flying off in the wrong direction. It looks like the bullet angle of motion is being set 180 degrees off. However, I've confirmed that the angle is being set correctly so the issue must be in something else that I can't figure out. Also, this issue only happens with player 1. Player 2's (who's hard-coded in to be controlled with a controller right now) shocks always send people off at the right angle.
Any help would be greatly appreciated!
Posts: 2
Reputation: 924

Post » Wed Jul 03, 2013 1:04 pm


I couldn't reproduce your problem, but I did notice you set the bullet direction according to player.x,player.y, which is it's origin. The origin of the player however is in the middle of the player sprite and not at his feet where the defib-radius is.. So maybe if you calculate the angle from the imagepoint at the center of the defib-radius you'd get better results?

I don't know if this is the right answer to your problem, but it would seem more logical to me than using the middle of the player sprite..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
Posts: 6,160
Reputation: 19,775

Post » Wed Jul 03, 2013 1:33 pm

Thanks for the quick reply. You're right that it makes a lot more sense to have the angle calculated from the base of the sprite. After changing this however I'm still having the same issue.
I probably wasn't clear enough about the issue; if you stand (for example) above an NPC and do a defib about half the time they fly up instead of down as you would expect.

Posts: 2
Reputation: 924

Return to How do I....?

Who is online

Users browsing this forum: OddConfection, senna68, smlyldz and 11 guests