From d1ccd84e74771474a7cdadb2e23a4950b2896995 Mon Sep 17 00:00:00 2001 From: fdai7910 Date: Sat, 3 Feb 2024 19:50:45 +0100 Subject: [PATCH] added triggerItem function to cell --- src/main/java/pacmanGame/Cell.java | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/java/pacmanGame/Cell.java b/src/main/java/pacmanGame/Cell.java index 53105af..f01761e 100644 --- a/src/main/java/pacmanGame/Cell.java +++ b/src/main/java/pacmanGame/Cell.java @@ -8,4 +8,32 @@ public class Cell { this.pos = pos; this.type = type; } + + public void triggerDot() { + //todo: code + } + + public void triggerPill() { + //todo: code + } + + public void triggerFruit() { + //todo: code + } + + public void triggerItem() { + if(type.equals("dot")) { + triggerDot(); + } + else if(type.equals("pill")) { + triggerPill(); + } + else if(type.equals("cherry")) { + triggerFruit(); + } + else { + System.out.println("cell contains no item!"); + } + } + }