Create Object vs Spawn Object [SOLVED]

Just started using Construct 2? Post your questions here

Post » Tue May 02, 2017 9:43 pm

Err, having problem with my spaceship shots here. Recoding new version.

Originally they followed rotating ship no problem, matching angle etc w bullet behaviour.

In new version, I'm using Create Object though and can't figure out how to make the shots match the player ship angle.

They do weird things if u set angle to player ship, etc. Pinning does not work.

Not sure what I'm doing wrong. Think I would rather use Create Object for shot spawning due to position offset possibilities vs just Spawning Object at image point?

Edit: You can actually do position offset it seems from the imagepoint also with a variable, but it only does a Y offset if you do a -value? Looking for X offsets.
Last edited by AmpedRobot on Wed May 03, 2017 6:49 pm, edited 2 times in total.
B
41
S
20
G
18
Posts: 274
Reputation: 13,055

Post » Wed May 03, 2017 4:14 am

We cannot diagnose "weird things". Post an example, or be more specific.

When talking about angles, the most obvious thing is that the default "forward" angle faces right in the image editor, it is a common mistake to have your projectiles facing up. Otherwise, if you're talking about offsets, your origin imagepoint probably isn't in the right place.

If these don't solve your problem, post an example to get better help.
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

Post » Wed May 03, 2017 2:26 pm

Duh. I always post a capx if noone replies.

No reason to be so rude and trollish. If I recall, you always do this and you're always wrong.

And it was very specific. Anybody who's familiar with this would be able to diagnose this in seconds.
B
41
S
20
G
18
Posts: 274
Reputation: 13,055

Post » Wed May 03, 2017 2:55 pm

Ok, here's the capx.

(Please ignore web site. It's very temporary. Not a plug or anything.)

http://www.darksunpictures.com/public/Layouts.zip

Basically trying to make the shots follow ship (square here).

You can click/touch anywhere to rotate ship.

Think I have to use Create Object as opposed to Spawn Object as trying to position the shots with offsets versus player ship position and I have some randomization involved.

This is very easy with Spawn Object, but it uses image points and an offset versus image point seems to work only in the Y?

Any help greatly appreciated.
B
41
S
20
G
18
Posts: 274
Reputation: 13,055

Post » Wed May 03, 2017 3:35 pm

AmpedRobot wrote:Duh. I always post a capx if noone replies.

No reason to be so rude and trollish. If I recall, you always do this and you're always wrong.

And it was very specific. Anybody who's familiar with this would be able to diagnose this in seconds.


Suit yourself then.
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

Post » Wed May 03, 2017 3:39 pm

EDIT: I think I solved this. I think I could do this with Spawn Object and a lot of different image points. It's an inelegant solution and it will bloat the code a little, but it should work. On the other hand, if there's a quick way to do it with Create Object, that's a functionality that should be programmed in because there you have the X and Y coordinates and you could do quick position randomization offsets via a variable. Plus it requires a lot of work from the user for what should be just a quick variable fix.
B
41
S
20
G
18
Posts: 274
Reputation: 13,055

Post » Wed May 03, 2017 3:49 pm

http://www.blackhornettechnologies.com/Construct2Stuff/layouts_BHT.capx
Tweaked a few things but setting the angle to the player seems OK.
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Wed May 03, 2017 6:48 pm

Dude, you are my God.

I will shower you with CGI items when any of the Dark Sun games come out. :D

I was about to start work on the slow and tedious version.

So glad I checked one last time.

Believe it or not I tried the exact same thing and it wasn't working at all. It was making existing shots turn and other weird things.

Admittedly, my shot code was a lot more complex, so I had a lot more stuff going on over there.

Also, I was using a much older version of Construct 2.

But great to know this works! Will save me an unbelievable amount of work.

Cheers!!!
B
41
S
20
G
18
Posts: 274
Reputation: 13,055

Post » Thu May 04, 2017 4:41 pm

@Ashley

If you go the image point route or even the variable route, there seems to be compression (ignoring of some image points/variable offsets) when you reach 90 and 270 degree rotation. When you think about it, it sort of makes sense because then an x offset should be a y offset, but with image points it should work and it doesn't or maybe it should be programmed in for both methods? I found a way around it.

Has anyone found a way to make the object continue rotating after just a tap to that position? Not sure how to program that in. Tried various things but it screws up other programming. So far the way that capx I designed is posted the square will only continue rotating to the clicked/touched point when you hold it.
B
41
S
20
G
18
Posts: 274
Reputation: 13,055


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests