Results 1 to 8 of 8

Thread: [Lua Question] AI

  
  1. #1
    monster356 is offline -Hacks Newbie
    Join Date
    Jun 2005
    Location
    VT
    Posts
    39
    Rep Power
    15

    Default

    Well I have made some progress in my game, and I am now working with pics a lil more, and I wanted to know if there was a way I could remove 2 pics instead of all pics

    If so, how?


  2. #2
    LordCthulu is offline Senior Member -Hacks Enthusiast
    Join Date
    Mar 2005
    Posts
    578
    Rep Power
    15

    Default

    "remove" ?
    If you mean make it so they don't show up, just dont' do
    screen:blit(x, x, image)
    and it's ` "removed" '
    Oldest psp-hacks member ever.

  3. #3
    monster356 is offline -Hacks Newbie
    Join Date
    Jun 2005
    Location
    VT
    Posts
    39
    Rep Power
    15

    Default

    "remove" ?
    If you mean make it so they don't show up, just dont' do
    screen:blit(x, x, image)
    and it's ` "removed" '
    never mind, i just used a couple variables to go with my collision detection
    and BAM it works, except only the enemy disapears

    and now a new question, How do I make a picture move towards my Sprite kinda like AI

  4. #4
    LordCthulu is offline Senior Member -Hacks Enthusiast
    Join Date
    Mar 2005
    Posts
    578
    Rep Power
    15

    Default

    Animation you mean?
    Oldest psp-hacks member ever.

  5. #5
    monster356 is offline -Hacks Newbie
    Join Date
    Jun 2005
    Location
    VT
    Posts
    39
    Rep Power
    15

    Default

    Animation you mean?
    kinda

    but i need my enemy to aproach my ship and shoot at it

    basically it comes from offscreen and once it get's onscreen(it can com on from any angle) it starts to shoot at my ship. here is a diagram

    S = Ship
    -- = enemy
    < = enemy bullet

    PSP screen-=---=-|
    ........................../
    -----------------------------------------
    |-----.................................--<-----| <---------|
    |.....-----..................----<---..........|..............|
    |...........-----.......--<-....................|..............|
    |----------------S---<------<----<----| <---Starting point
    |...........-----.......--<-....................|..............|
    |.....-----..................----<---..........|..............|
    |-----.................................--<-----| <---------|
    -----------------------------------------

  6. #6
    LordCthulu is offline Senior Member -Hacks Enthusiast
    Join Date
    Mar 2005
    Posts
    578
    Rep Power
    15

    Default

    Ahh...
    Hm..
    Well, lemme think for a second..
    Maybe you can have a function that gets the players coords, and (is this real time or turn based?) have the enemy ship move to within a certain distance, then start firing off shots? Oo;
    Oldest psp-hacks member ever.

  7. #7
    monster356 is offline -Hacks Newbie
    Join Date
    Jun 2005
    Location
    VT
    Posts
    39
    Rep Power
    15

    Default

    Ahh...
    Hm..
    Well, lemme think for a second..
    Maybe you can have a function that gets the players coords, and (is this real time or turn based?) have the enemy ship move to within a certain distance, then start firing off shots? Oo;
    real time

  8. #8
    LordCthulu is offline Senior Member -Hacks Enthusiast
    Join Date
    Mar 2005
    Posts
    578
    Rep Power
    15

    Default

    Ok. Not quite sure how you are doing it, but perhaps doing something like..

    if we_need_enemy then
    spawn_enemy;
    end

    enemy_coords = x, y;

    if enemy_is_out_of_firing_range then
    enemy_coords = enemy_coords + (one_step_closer_to_player) --bad
    end

    if enemy_is_within_firing_range then
    enemy_shoot;
    end

    check_for_enemy_bullet_contact;

    if player_shot then
    is_enemy_hit = true;
    if is_enemy_hit == true then
    destroy_enemy; -- Cap the ship, or detract dmg from the enemy
    end
    end

    Theres some psuedo-code for ya. Sorry if it's confusing, i got in a dirtbike accident yesterday and im still a little messed up. Feels like I went into the ghetto with a shirt that says "I hate n*****s" haha...yeah. Anyway, i'll try to help if you need anything.
    Oldest psp-hacks member ever.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •