Check continuously for tiles between two actor's centers...

Vaibhav Sangwan

  • Posts: 160
Hi everyone :)

I am currently making a 2-d shooter game and I need some help.
Okay, so there are many enemy soldiers roaming in the scene.
I want a way by which if an enemy comes in a region of 300 pixels(I have created a region named "Region around actor" which follows my player) around my player,
it continuously checks if there is any tile between the his center and my player's center.
If there isn't, then add it to a list named "active enemies"


Any ideas?
It'll be really helpful
Currently working on:-
http://www.stencyl.com/game/play/42376
Feedback will be really appreciated

JeffreyDriver

  • Posts: 2262
You need raycasting to solve this. I've seen this question mentioned before, and there is an extension - http://community.stencyl.com/index.php/topic,16734.0.html


Vaibhav Sangwan

  • Posts: 160
Thanks Jeffery,
It solved my problem.
And thanks to coleislazy too, for making such a useful extension.
Although I had some problem implementing this at first.
The problem was that I created line between actor centers.
So,when I used the "first actor on line" code,it gave me the values of actors.
But at last,I managed to create lines in a way that they don't intersect with actors.

« Last Edit: March 10, 2018, 07:28:20 am by Vaibhav Sangwan »
Currently working on:-
http://www.stencyl.com/game/play/42376
Feedback will be really appreciated

Vaibhav Sangwan

  • Posts: 160
I happen to have a problem.
Until now,I was using if "list contains no items", but now there is a need to use "list contains ______"


What name should I fill in "if list contains ______" (in which list contains all the actors between two actor centres) to know if there is a tile


When I used when drawing event to display all actor's names in the list, there was one with the name "Terrain,Actor 100000000"
I tried inserting Terrain and Terrain_100000000, but it didn't solve my problem.


edit: solved, made a loop(for each item in list) to check if any item's group is Tiles




« Last Edit: March 17, 2018, 06:46:15 am by Vaibhav Sangwan »
Currently working on:-
http://www.stencyl.com/game/play/42376
Feedback will be really appreciated