switch(key){
case 'W': mainCharacter.moveUp();
case 'D': mainCharacter.moveRight();
case 'S': mainCharacter.moveDown();
case 'A': mainCharacter.moveLeft();
}
Thoughts on what a possessor is and why we would make a possessor:
1) I'm up late so sorry if these ideas become unsound in 2 days
2) Instead of accessing an NPC or AI actor and then directly calling setPosition on it to shift position, I like using a master Possessor to take control of it and issue canonical commands. This might lead to better modulation, and we write less code when issuing several commands to the same list of actors.
E.g.:
Instead of
ZombieActor.setPosition(lastPos - 3, lastPos - 4)
RandomActor.setPosition(lastPos - 3, lastPos - 4)
ZombieActor.throwTrap(x, y, fireTrap);
RandomActor.throwTrap(x, y, fireTrap);
The problem for this pattern arises when there are actors with many different methods (not enough similar commands).
In Possessor (to be made):
Possessor.possess(Actor toPossess) // possesses an actor, stop all other possessions
Possessor.addPossession(Actor toPossess) // possessor one additional an actor
Possessor.removePossess(Actor toRemovePossess) // stop possessing an actor
Possessor.refresh() // removes all possession
Possessor.issueCommandsToAll(command [])
Possessor.issueCommands(Actor, command [])
Possessor.issueCommand(command)
Posessor.setTemporaryMain(Actor) // experimental thoughts, what if we made a function that temporarily sets another character as the main actor (allows player input to move character and centers camera on it)? Maybe we get some ghost abilities that allows us to temporarily control other ghosts but leaves our original body vulnerable to attack? Maybe too much functionality.
Possessor.revertMain() // give control back to original main character
Command has schema:
{
command_type: string;
params: Hashmap (aka a dictionary in python or just an object in javascript)
}
Movable main character
In UserView, set up camera correctly and do this:
Thoughts on what a possessor is and why we would make a possessor: 1) I'm up late so sorry if these ideas become unsound in 2 days 2) Instead of accessing an NPC or AI actor and then directly calling
setPosition
on it to shift position, I like using a master Possessor to take control of it and issue canonical commands. This might lead to better modulation, and we write less code when issuing several commands to the same list of actors. E.g.:Instead of
We can maybe do:
The problem for this pattern arises when there are actors with many different methods (not enough similar commands).
In Possessor (to be made):
Command has schema: