Skip to main content
added 2 characters in body
Source Link
Arthur
  • 103
  • 7

On the PuzzleScript home page, there is an example of an enemy (Eyeball) which, when you (Player) are directly in its line of sight, will move one square closer to you, using the rule

[ Eyeball | ... | Player ] -> [ > Eyeball | ... | Player ]

However, the Eyeball will walk towards Player even if it shouldn't be able to see you, for instance if there is a wall in the way. This is apparent in a level like

#########
#....O..#
#.......#
#########
#.......#
#..P....#
#########

where, if Player passpasses below Eyeball, Eyeball will move one square down.

How do I make it so that the enemy can't see me through walls?

Inserting no Wall into the rule above doesn't work, as that doesn't tell ... to only match wall-free tiles, but rather checks whether there is at least one non-wall tile between Eyeball and Player. And adding the rule

[ > Eyeball | ... | Wall | ... | Player ] -> [ Eyeball | ... | Wall | ... | Player ]

in an attempt to correct the movement doesn't work as two ellipses in a single match pattern isn't allowed.

On the PuzzleScript home page, there is an example of an enemy (Eyeball) which, when you (Player) are directly in its line of sight, will move one square closer to you, using the rule

[ Eyeball | ... | Player ] -> [ > Eyeball | ... | Player ]

However, the Eyeball will walk towards Player even if it shouldn't be able to see you, for instance if there is a wall in the way. This is apparent in a level like

#########
#....O..#
#.......#
#########
#.......#
#..P....#
#########

where, if Player pass below Eyeball, Eyeball will move one square down.

How do I make it so that the enemy can't see me through walls?

Inserting no Wall into the rule above doesn't work, as that doesn't tell ... to only match wall-free tiles, but rather checks whether there is at least one non-wall tile between Eyeball and Player.

On the PuzzleScript home page, there is an example of an enemy (Eyeball) which, when you (Player) are directly in its line of sight, will move one square closer to you, using the rule

[ Eyeball | ... | Player ] -> [ > Eyeball | ... | Player ]

However, the Eyeball will walk towards Player even if it shouldn't be able to see you, for instance if there is a wall in the way. This is apparent in a level like

#########
#....O..#
#.......#
#########
#.......#
#..P....#
#########

where, if Player passes below Eyeball, Eyeball will move one square down.

How do I make it so that the enemy can't see me through walls?

Inserting no Wall into the rule above doesn't work, as that doesn't tell ... to only match wall-free tiles, but rather checks whether there is at least one non-wall tile between Eyeball and Player. And adding the rule

[ > Eyeball | ... | Wall | ... | Player ] -> [ Eyeball | ... | Wall | ... | Player ]

in an attempt to correct the movement doesn't work as two ellipses in a single match pattern isn't allowed.

added 84 characters in body
Source Link
Arthur
  • 103
  • 7

On the PuzzleScript home page, there is an example of an enemy (Eyeball) which, when you'reyou (Player) are directly in its line of sight, will move one square closer to you., using the rule

[ Eyeball | ... | Player ] -> [ > Eyeball | ... | Player ]

However, this enemythe Eyeball will walk towards youPlayer even if it shouldn't be able to see you, for instance if there is a wall between you and itin the way. One can see thisThis is apparent in a level like

#########
#....O..#
#.......#
#########
#.......#
#..P....#
#########

where, if youPlayer pass below the enemyEyeball, itEyeball will move one square down.

How do I make it so that the enemy can't see me through walls?

Inserting no Wall into the rule above doesn't work, as that doesn't tell ... to only match wall-free tiles, but rather checks whether there is at least one non-wall tile between Eyeball and Player.

On the PuzzleScript home page, there is an example of an enemy which, when you're directly in its line of sight, will move one square closer to you. However, this enemy will walk towards you even if it shouldn't be able to see you, for instance if there is a wall between you and it. One can see this in a level like

#########
#....O..#
#.......#
#########
#.......#
#..P....#
#########

where, if you pass below the enemy, it will move one square down.

How do I make it so that the enemy can't see me through walls?

On the PuzzleScript home page, there is an example of an enemy (Eyeball) which, when you (Player) are directly in its line of sight, will move one square closer to you, using the rule

[ Eyeball | ... | Player ] -> [ > Eyeball | ... | Player ]

However, the Eyeball will walk towards Player even if it shouldn't be able to see you, for instance if there is a wall in the way. This is apparent in a level like

#########
#....O..#
#.......#
#########
#.......#
#..P....#
#########

where, if Player pass below Eyeball, Eyeball will move one square down.

How do I make it so that the enemy can't see me through walls?

Inserting no Wall into the rule above doesn't work, as that doesn't tell ... to only match wall-free tiles, but rather checks whether there is at least one non-wall tile between Eyeball and Player.

Source Link
Arthur
  • 103
  • 7

How to make walls opaque in PuzzleScript

On the PuzzleScript home page, there is an example of an enemy which, when you're directly in its line of sight, will move one square closer to you. However, this enemy will walk towards you even if it shouldn't be able to see you, for instance if there is a wall between you and it. One can see this in a level like

#########
#....O..#
#.......#
#########
#.......#
#..P....#
#########

where, if you pass below the enemy, it will move one square down.

How do I make it so that the enemy can't see me through walls?