Image Point & Object Spawning

This forum is currently in read-only mode.
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • I am working on a simple combat mechanic. When <font face="Courier New, Courier, mono">control</font> is pressed, a bullet should spawn at the player's image point named "Bullet". As far as I can tell, I have centered the image point. When I run the game, the image spawns northeast of the sprite.

    I am spawning the bullet in the same layer as the player. I have called the layer "PlayerLayer" to ensure there is no confusion.

    The sprite is only 16x16, could that be affecting this?

    I can move the image point to the southwest of my sprite, but it is difficult to align and will be impractical when I start working with multiple animation frames. Also, if I align in this way, I have found that performing a rotation with "set angle" will move the image point off of the center of the sprite again.

    Any thoughts?


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you upload a copy of the source with just the two objects and events for shooting? It sounds like the hotspot of the bullet hasn't been centered. Sprites start at 128x128 size, so after shrinking to 16x16 it's possible the hotspot is still outside the object.

    Also, you could be spawning the bullet at the hotspot of the main character as well, try spawning the bullet at image point 1 if you're not spawning it at the image point name (as image point 0 is the hotspot).

    I've not seen hotspots and image points mentioned much on the forums, so here's a quick write up on how they work: Hotspots are the red dots and can only have one per object as that is where the X and Y for the object are calculated from, when positioning objects they are treated as image point 0.

    Image points are manually placed and added to sprites, and they are numbered from 1 and up, or can be named.

    There is also issues at times where placing an image point will move your hotspot or vice versa, so it's worth checking the hotspot and image points are all in correct places after working with them.

  • Hmm... Perl homework has apparently destroyed my brain... how do I post a .cap file?

    Do I need to host it somewhere else and link here? Or is there an attach file command I'm not seeing?

  • Yeah, seems people are using SkyDrive more now, but DropBox is probably the best way of sharing them right now =)

  • Well shoot. I can't post links until I have 500 reputation.

    If I'm missing any resources, please let me know. This is my first time sharing a .cap file.

    I hope this doesn't go against forum policy:

  • The bullet's hotspot wasn't centered, but way off. Just center it, and it should work.

  • Thank you!

    I don't know why I didn't think to check the bullet's hotspot.

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