Allied AI Project Alpha
I recently started working on a Allied AI script while working on the book project. I am panning only 2 allies like in Secret of Mana (Seiken Densetsu 2).
Finished: (All lag is due to bad gifs, the Solarus engine runs fine)
- Basic Follower Script - The Ally custom entity follows the hero and when the ally gets stuck (hit an obstacle), it searches for the hero.
I seriously cannot believe at how easy this is to program. Thank you Christopho for the amazing functions.
(https://media.giphy.com/media/l4FGvYZEp4DI7vmow/giphy.gif)
Not finished:
- Melee
- Projectiles
- Custom Entity Enemy
- Enemy
Here is a cool function I made for this project. The lib I am making has a bunch of other functions to make showing images easier. This was made to display stats, item amounts, etc.
Preview: (Login to View)
(http://forum.solarus-games.org/index.php?action=dlattach;topic=949.0;attach=674)
It is declared like this.
game:set_value("money", 2)
game:set_value("gem", 3)
game:set_value("silver", 4)
entity:font_draw(1,"MONEY: ", 30, 50, "money")
entity:font_draw(2,"GEM: ", 30, 80, "gem")
entity:font_draw(3,"SILVER: ", 30, 110, "silver")
entity:font_create(3, font_name, text_size, render_mode, color_rgb, map)
--remove gem text
entity:font_undraw(2)
--true remove all text
entity:font_undraw(font_index, true)
These sprite draw functions that I made for this project can draw a sprite at:
1. The hero
2. An entity
3. A position
It can remove:
1. Any sprite index
2. All of them at once
By default it uses a death animation.
--create 4 sprites and draw on map
entity:sprite_create(4, map)
--Draw at coordinates
entity:sprite_draw(1,"main_heroes/eldran", 130,100, true)
--Draw at coordinates
entity:sprite_draw(2,"main_heroes/eldran", 100,100, true)
--draw at hero
entity:sprite_draw(3,"main_heroes/eldrina/eldrina", 0,0, true, start_anime, start_sound, end_anime, end_sound, true, hero_visable, false)
--draw at an entity named "old"
entity:sprite_draw(4,"main_heroes/eldrina/eldrina", 0,0, true, start_anime, start_sound, end_anime, end_sound, hero_pos, hero_visable, false, direction, true,"old", entity_visable)
--remove sprite 1
entity:sprite_undraw(1)
--remove all sprites if true
entity:sprite_undraw(1,true)
--or
--remove all sprites if true
entity:sprite_undraw(true)
They all fall down.
(https://media.giphy.com/media/3ohzdSloTkCbw9qG7C/giphy.gif)