Image Point & Object Spawning

For questions about using Classic.

Post » Mon Nov 26, 2012 7:13 pm

I am working on a simple combat mechanic. When control 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?


Thanks,
B
3
Posts: 6
Reputation: 287

Post » Tue Nov 27, 2012 12:10 am

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.
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Thu Nov 29, 2012 2:10 am

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?
B
3
Posts: 6
Reputation: 287

Post » Thu Nov 29, 2012 3:13 am

Yeah, seems people are using SkyDrive more now, but DropBox is probably the best way of sharing them right now =)
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Thu Nov 29, 2012 3:49 am

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:

https://www.dropbox.com/s/gy31208yy6sprz4/ShootingTest.capFahall2012-11-29 03:51:43
B
3
Posts: 6
Reputation: 287

Post » Thu Nov 29, 2012 6:53 pm

The bullet's hotspot wasn't centered, but way off. Just center it, and it should work.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Nov 30, 2012 7:38 pm

Thank you!

I don't know why I didn't think to check the bullet's hotspot.
B
3
Posts: 6
Reputation: 287


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests