-
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
now that we have the stencil feature which is a present from virtualC64 V4 ... we can better analyse the playfield ... and drive our attention more to the important things of live and that is to win games ...
to make bot programming much more easy than now ... the idea is to write some classes which hide and abstract the computation of angles ... and only informs the bot class about important game events like "enemy is to your left" or "enemy diagonal right up of you" ...
class myBot extends Bot {
incoming_event(event) {
if( 1<event.other_sprite && event.other_sprite<7 )
{
aim_and_shoot(event.other_sprite);
}
if(event.other_sprite_position == 'left' || event.other_sprite_position == 'right')
{
move("down", 800); //move down 800ms
}
}
}
new myBot( sprite=0 ).run(port=1); /* 0 is the sprite_id controlled by the bot*/
the self designed bot will extend the following base class which will give it the API to communicate and interact with ...
class Bot {
constructor(sprite_id)
//getter
get x()
get y()
get port()
//methods
distance(other_sprite)
x(other_sprite)
y(other_sprite)
aim_and_shoot(other_sprite_id)
move(direction, time)
run(controller_port)
}
Metadata
Metadata
Assignees
Labels
No labels