How do i create, ai that shoots upon variables
AjBlue
Member Posts: 215
in my game i need to create an enemy, when spawned it moves straight to the other side and when another actor gets within a certain distance, for the enemy to shoot at the actor. any ideas?
Comments
Usage: magnitude(x,y)
Find the length of a line segment from the origin, (0,0), to the given point. You can include an offset,(x',y'), to find the length between the two points. i.e. magnitude(x-x',y-y')
Example: If I wanted to find the length between my actor at coordinates (25,30) and another actor at coordinates (100,240), I would use the expression magnitude(25-100,30-240)
http://gamesalad.com/game/1804
First things first create an actor called projectile(the bullet your guy will be shooting)
and 2 attributes named HeroX ,and HeroY
`
//Inside the hero
=====constrain attribute=====
Self.Position.X - to - Game.HeroX
=====================
=====constrain attribute=====
Self.Position.Y - to - Game.HeroY
=====================
//inside the enemy
-------Rule---------
actor - overlaps or collides with - actor of type - range
-------------------
====Timer====
Every 1 second
====Spawn actor====
Projectile
================
===========
//Inside Projectile Actor
====Move To====
Game.HeroX
Game.HeroY
`
Hope I helped....
-Josh
when you say make an attribute, what type should it be?