autotargeting
ok i'm a bit frustrated. i've searched through the tutorials and tried a couple of ideas of my own between range based and overlap/collide but i cant get it to work quite right.
Basically the goal is to have a "gun" rotate towards and fire at a target that gets within a certain range of it. Then when that target is destroyed or leaves the range, the gun finds a new target.
Really getting frustrated as i have a whole slew of game ideas ready but none of them will work if i cant get this to work. Can anybody help me out or point me to a demo?
Basically the goal is to have a "gun" rotate towards and fire at a target that gets within a certain range of it. Then when that target is destroyed or leaves the range, the gun finds a new target.
Really getting frustrated as i have a whole slew of game ideas ready but none of them will work if i cant get this to work. Can anybody help me out or point me to a demo?
Comments
make attribute Boolean name it "selected"
then on actor make a rule
when button is pushed, or mouse button is down and inside "enemy"
change attribute "selected" to true
change image to any image probably one with it being selected
then in otherwise have a change image to the unselected image
and add a change attribute "selected" to false
then use the firing ability u have to have the bullett follow the actor using follow bullets x,y
this is my way of doing it hope it helps
I can get the gun to track the first thing that enters the area but for the life of me i cant get it to target again after the first one. One of the most recent attempts i have the targets going to 4 waypoints around the screen, each being able to take two hits but its not working. i think i'm making it too complicated.
Try making a game attribute called "trackingOn". Set it to 0 (or false if you made a boolean). Then when an enemy is in the tracking area, change "trackingOn" to 1 (or true if boolean). Then have a rule that says when "trackingOn" = 1 start aiming and firing on the enemy. When the enemy is destroyed, change "trackingOn" back to 0, and wait until the next enemy enters the tracking area.
Or is the issue a matter of designating the next target? In that case, you could try something like when an enemy enters the tracking area, it needs to start broadcasting its position to a set of game level attributes. (Perhaps called "targetX" and "targetY".) The gun then fires at these coordinates.
Same concept though. Each gun would have its own 'kill zone" (for lack of a better term) with its own game level attributes associated with it. When an enemy enters the kill zone for that particular gun, the enemy starts broadcasting its position to some global attributes that the particular gun is tracking.
Here is another way to explain it. Think of each gun as a separate mini game. If you have four guns in the scene, it will require four separate sets of sensors and attributes.
Imagine the user is able to put multiple versions of the same gun into play, each one is going to have to work independently against multiple targets being generated.
its tough. i've got paper everywhere from ideas being scribbled and many saves alternate saves of trying things out.
That way it will stop tracking when out of zone. Not sure if it will fit the needs of your game
Hope this is helpful!