Trouble with object instances

Get help using Construct 2

Post » Tue Nov 06, 2012 4:11 am

I know what I said, but I cant concentrate properly until this is resolved (bit of an OCD thing perhaps! lol)

Check this out, given how your game layout works I think you will like it. Props to Rexu because it is adapted from a great example he put out a while ago about line of sight.

http://db.tt/UMER0sU0GenkiGenga2012-11-06 04:11:52
ImageImage
B
73
S
16
G
6
Posts: 1,038
Reputation: 10,473

Post » Tue Nov 06, 2012 1:57 pm

Thanks for all the help guys! Ok, I see now I was doing it all kinds of wrong. I added the line of sight stuff you posted GenkiGenga, and I'm also trying to use UIDs to filter objects. I'm still getting a problem with 2 enemies firing at the player even if only one of them is in range. I know its something to do with checking the UID but I'm not sure how to proceed. Here's the latest capx...

https://docs.google.com/open?id=0BwoaeBCiAbv0SmJ5eEhQZFNUdzQ
B
5
Posts: 11
Reputation: 722

Post » Tue Nov 06, 2012 9:35 pm

Arg! Another issue I'm having is that when I pin newly spawned line-of-sight objects to enemies that are not created at runtime (they are just placed in the layout view) it ends up pinning all the line-of-sight objects to a single enemy..!

Here's how I'm pinning them:


Any ideas?

edit: oh and here's the capx
https://docs.google.com/open?id=0BwoaeBCiAbv0YWNjQXFFRWZnTnMwhaleyboy2012-11-06 21:38:10
B
5
Posts: 11
Reputation: 722

Post » Thu Nov 08, 2012 12:23 am

I never used the line of site tutorial, (yet) so someone who has used it may sort out some of the problems with that.

But just a quick look changing event 3 to be "For Each" enemy (under system) seemed to fix the lines connecting to the right ememy...

Edit: Oh, just noticed I could shoot, shot one and saw it left the line of site sprite.
Add an event so if a line isn't pinned destroy it. Like event 5 in the image.


Ok, looking a little more, I think I see one conflict, event 12, (13 if you aready added the destroy line event above.)

12. IF player is overlapping a Line, AND any of those lines are not on a wall.

It is possible for the player to be overlapping more than one line, and only one has to be clear of the wall.
Paradox2012-11-08 00:41:42
B
200
S
51
G
30
Posts: 896
Reputation: 36,494

Post » Thu Nov 08, 2012 12:54 am

Looks like in Event 4 the length of all the lines is set by the distance between the player and the enemy with the lowest ID. (in other words neither are picked.)

it needs a "for each" there as well, but that is where you need to have an ID to tell which line belongs to which enemy. This is where the knowledge of the Line of site routine would help.

Edit: Nevermind, it hit me how the routine must work, instead of the distance between the enemy and the player, just use the Line_of_Sight.x and Y instead. (line 4 change "Enemy.x" to "Line_of_Sight.x" & "Enemy.y" to "Line_of_Sight.y"

that fixes it. However the lines seem to be offset like the origin point is at the top left. Ah, just checked, the origin point is right in frame one, but jumps all over the place on other frames and animations.

Well, I have it, I may as well save you the typing now:
https://dl.dropbox.com/u/85412219/forumposts/ninjaproject.capx

however even with the origins all centered, it still seems to draw the lines offset.Paradox2012-11-08 01:15:48
B
200
S
51
G
30
Posts: 896
Reputation: 36,494

Post » Thu Nov 08, 2012 8:20 pm

Thanks for that! Its a definite improvement. Getting my head around how this all works is proving more difficult than I first thought. Glad to know there are people around who are so good at answering questions :)
B
5
Posts: 11
Reputation: 722

Post » Fri Nov 09, 2012 7:09 am

Sorry about that Whaleboy, I didnt have time to test what I had put up. I can see the issues you were talking about. After sleeping, I took another look and here is your logic for the enemies.

Now it is a mixture of Rexu and Rojo. The big difference is that we are basing our timing around the enemies cooldown instead of 'Every x seconds'.

The problem with the old one was that we werent correctly picking the enemy to fire. Combined with the line of sight for obstacle detection its perfect as a base for a lot of top down games.

http://db.tt/Y3OCQcD2
ImageImage
B
73
S
16
G
6
Posts: 1,038
Reputation: 10,473

Post » Sat Nov 10, 2012 3:22 pm

Nice one!
What is Rexu and Rojo? Also you have a condition where the enemy spawns a ninja star that says Player->Pick nearest to (Enemy.X, Enemy.Y) Could you explain what that is for?
B
5
Posts: 11
Reputation: 722

Post » Wed Aug 07, 2013 12:33 pm

I have no idea what is Rexu and Rojo too XD
B
20
S
4
G
3
Posts: 136
Reputation: 2,774

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests