actor at a distance

rdcuberdcube Member Posts: 361
edited November -1 in Working with GS (Mac)
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.

Comments

  • JGary321JGary321 Member Posts: 1,246
    use random

    when size = 100x100 change attribute self.random # to random(1,100)

    If self.random # > 50 then (whatever on hit)
    otherwise (do nothing)
  • rdcuberdcube Member Posts: 361
    That's how I have it, but that's not exactly how I want it to behave. what I need is something more in the lines of actors is far, actor is near.

    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?
  • JGary321JGary321 Member Posts: 1,246
    NEED
    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.
  • rdcuberdcube Member Posts: 361
    Good deal JGary, will give that a 'shot'.

    Thanks ;~)
  • rdcuberdcube Member Posts: 361
    Just fyi, this is kinda the game I want to remake, but backwards: http://www.gamesarcade.net/free-online-games/trapshoot/trapshoot.asp

    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!
Sign In or Register to comment.