Closed smileyface12349 closed 1 year ago
Check if the train's position moves within a circle around the collectible. If so, trigger something.
If it's a collectible, just call some function and score will be added etc. If it's a wall, need to tell some function to return null to let it derail (I can do this if you want)
When picking up a frog, call AddPoints(1000) on the ExecuteLevel script attached to the LevelController
(Also please make prefabs for frogs and walls)
Change of plan: Please call CollectFrog() on the ExecuteLevel script, and do not call AddPoints() at all.
Forgot to say, you'll probably want to check out triggers for this. A trigger is like a collision, but it just fires an event and doesn't actually collide.
I'd have a script on each collectible/wall which then detects if something enters its trigger radius. It should then check that this object is in fact the train (a name check would suffice), and then act accordingly. For a collectible, after calling the relevant method it should destroy itself. For a wall, it should pass some signal to tell the train to derail itself.
Does a method to end the level exist yet?
There's a Derail() method.
I can make a method on the ExecuteLevel script to call the relevant method if you like.
Just added a method: Call Fail() in ExecuteLevel
Great job!
Need to determine if graph goes through it. Could try to get intersection with a circle?
Obviously collectibles are good and walls are bad. Collectibles will probably be frogs that can jump into the train. These should add to your score. Walls will make the train crash.