How do I MagiCam cursor problem and animation knockback

0 favourites
  • 7 posts
From the Asset Store
Mouse cursor is something that the player controls and sees all the time, that's why it is so important to make it cool!
  • 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 --

  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • --

    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?

  • 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:

    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))[/code:1lh7nxzw]
    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.
  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)