actor at a distance
rdcube
Member Posts: 361
does anybody know how to have an actor at a distance (far) and hit an another actor that is 'near'?
I tried the magnitude demo, but that's not quite what I'm looking for.
What I would like to have, is an actor that looks like is coming from far (small at a distance), grows as it gets near and if it gets close enough, it will hit you.
the only thing I could do is have an image that starts at 1x1 px and once it gets to 100x100 do something...but that will always hit you, I need a way evade and 'see it coming'
hope this makes sense and someone can help.
thanks.
I tried the magnitude demo, but that's not quite what I'm looking for.
What I would like to have, is an actor that looks like is coming from far (small at a distance), grows as it gets near and if it gets close enough, it will hit you.
the only thing I could do is have an image that starts at 1x1 px and once it gets to 100x100 do something...but that will always hit you, I need a way evade and 'see it coming'
hope this makes sense and someone can help.
thanks.
Comments
when size = 100x100 change attribute self.random # to random(1,100)
If self.random # > 50 then (whatever on hit)
otherwise (do nothing)
Where I'm stuck on is, where is 'near' trigger?
My main actor is in the middle of the screen, and 'missiles' will appear far (the way I have this is by making my image start at 1x1 px and increment every second until reaching 100px). My main actor has a 'collide with actor (missile)'.
So as u can see, even though the missile is only 1x1 px, it still collides with the main actor and always hits it.
Perhaps my logic is reverse, but can't quite figure it out.
Any ideas?
actor attribute self.random # (leave it set to 0. This is so it does not trigger prematurely)
IF self.size.height = 100 & self.size.width = 100 THEN
Change self.random # to random(1,100)
If self.random # = 49-100 then hit
OTHERWISE If self.random # = 1-50 then don't hit
The numbers can obviously be changed. But this will make it so it only chooses a random number when size = 100 & then it will execute.
Thanks ;~)
Select to shoot a 'chicken' as an example.
As you can see, chickens run away and get smaller, making the shot almost impossible.
What I want to do, is have the 'chicken' come closer and if it's 'near' u, it hits u.
If anybody has other suggestion and/or 'demo/prototype' that can upload, that would be awesome.
Thanks again!