The service is unavailable.

How do I MagiCam cursor problem and animation knockback

Get help using Construct 2

Post » Tue Feb 17, 2015 9:25 pm

When I use MagiCam to follow a sprite (the sprite goes where the mouse cursor moves) the sprite will not follow the mouse and go off screen. I want it to follow the mouse cursor exactly.

Also, I am having problems with making the enemies contained with a bullet sprite get knockedback from taking a bullet.

More info on what is happening here. I have one sprite a bullet (the one with opacity) and the other on top of it which will be the animation. I want them to be knocked back when they are hit but I can't get them to both by knocked back. If I make a bullet hit the animation it stays with the sprite with the bullet. If I make the bullet hit the sprite with the bullet then it doesn't knockback everytime.

Any help would be appreciated.

Capx here --https://www.dropbox.com/s/clhp375jtu7kg08/Magicamcursor.capx?dl=0--
B
8
S
3
Posts: 56
Reputation: 769

Post » Tue Feb 17, 2015 10:06 pm

I'd suggest looking at the example that comes with MagiCam when you download the plugin, because you seem to be misunderstanding how it works.

1. You shouldn't use the "Scroll To" behavior when using MagiCam.
2. You need to tell your MagiCam camera which objects to follow using the "Follow object" action.
3. You need to enable following for your MagiCam camera before it will follow anything, using the "Enable following" action.

EDIT: For the knockback problem, keep in mind that your Enemy object is following the Sprite object, not the other way around. You need to position Sprite to the location of Enemy at the time of knockback to get them both positioned the same.
Moderator
B
106
S
41
G
20
Posts: 1,584
Reputation: 18,917

Post » Wed Feb 18, 2015 12:04 am

I got the knockback to work. Thanks.

I looked at the example with the two object zoom and I made the orangebox follow my mouse. It worked perfectly besides for the orangebox or greenbox going offscreen but when I try it in my game the cursor won't follow the mouse's position.

Thanks for the reply and making MagiCam. I really like it and want to use it in my game.
B
8
S
3
Posts: 56
Reputation: 769

Post » Wed Feb 18, 2015 12:46 am

@Bodhran, you need to really look at the event sheet for the specific example you mentioned. Everything you need to get a similar movement is there, along with the points I mentioned in my previous post. I also recommend updating the file you have on DropBox with any changes you make so I can see more clearly what you're attempting.
Moderator
B
106
S
41
G
20
Posts: 1,584
Reputation: 18,917

Post » Wed Feb 18, 2015 1:00 am

--https://www.dropbox.com/s/clhp375jtu7kg08/Magicamcursor.capx?dl=0--

I updated it. I feel like it is the same as the example capx but there has to be something I am missing. The cursor doesn't follow the mouse's position and is there anyway to keep the cursor inside the screen?
B
8
S
3
Posts: 56
Reputation: 769

Post » Wed Feb 18, 2015 2:12 am

@Bodhran, the cursor looks to be following the mouse just fine. Perhaps you're not explaining exactly what you're looking to achieve.

As for keeping the cursor inside the screen, you should use the clamp function when setting its position. Something like:

Code: Select all
Set Cursor X to clamp(mouse.X, scrollx - (ScreenWidth / 2), scrollx + (ScreenWidth / 2))
Set Cursor Y to clamp(mouse.Y, scrolly - (ScreenHeight / 2), scrolly + (ScreenHeight / 2))

Note that ScreenWidth/ScreenHeight aren't expressions. Rather, they represent the window size of your game, which you can find in the game properties panel.
Moderator
B
106
S
41
G
20
Posts: 1,584
Reputation: 18,917

Post » Wed Feb 18, 2015 5:06 am

I figured out that I had scroll to on the player's behaviors lol.

It works perfectly. Thanks for the help. I really appreciate it!
B
8
S
3
Posts: 56
Reputation: 769


Return to How do I....?

Who is online

Users browsing this forum: henryScirra, matriax and 1 guest