[SOLVED] Need Advice w/ Laser PowerUp and Design

Hello everyone,

I have slowly being making progress with my laser power-up and today I think I hit a wall, so to speak. Up till now I have been making everything occur in the Paddle script. That is, the creation of the two laser missiles, instantiating the missile prefabs one left and another right, and also the movement of the missiles. And I think that this is where my problem lies. I can’t think of anyway that I will be able to create a collision between these ‘cloned’ objects and any other objects, that is the bricks and the top collider so I can destroy the missiles and be allowed to fire again. So is my reasoning correct on this matter?

And if so, will I need to create a separate base class for the missiles? And might I also then need a child object for the two missiles?? For the first time in this project I really don’t know how what I need to do to proceed :confused:. And what questions I need to ask.

To anyone who can give me advice here is a very BIG thankyou in advance.

Regards,
Vaughan.

it sounds like you need to do some refactoring on your object model. If you look at the objects in BlockBreaker, you have a Paddle, a Ball, n Bricks, and it seems now you have n Missiles. Properly encapsulating the behaviours of a Missile in its own script/class (and, given they share some but not all behaviour with a Ball, maybe generalising those common base behaviours into a new Collidable class or similar) will help you a lot.

You might also need to look at the LevelManager to broker the interactions between the objects, take care of spawning the Missiles etc on request from the Paddle (rather than by the Paddle) and a state machine might be useful for you - either code yourself or use something like PlayMaker (which is overkill, but cool :slight_smile: )

1 Like

Thanks @ninjachimp for your useful advice. It has given me a place to start! Although, I can already forsee places where I am going to run into problems. So with a ‘lot’ of googling and using this and the Unity forums I’ll get there in the end. Though the process can be painful at times.

That Playmaker tool looks interesting though - might look into that some more, had a look at a quick tutorial and it has caught my interest. It would be interesting to see how a FSM would work for creating certain aspects of games that aren’t to do with Prison Escape :grin:.

Thankyou and Regards,
Vaughan.

Privacy & Terms