Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

How to create mirror objects that laser bounces on in GM8?

Hi! My request involves the creation of mirrors, like in LASER TANK, BUT double sided; where the laser bounces perfectly from UP to LEFT, LEFT to UP, UP to RIGHT etc depending on WHERE YOU SHOOT FROM ; in GM8.

EXAMPLE:
(if you shoot up on a mirror tilted to the right, it bounces right, but if you shoot down on it, hitting the OTHER side of the same mirror, it bounces LEFT etc)

^ ^
---/---- ----\---
| |


I have tried but since I use BOTH sides of the mirrors, it doesnt seem to work perfectly.

THIS IS WHAT I WANT:

2qcpjyr.png


look at this picture from laser tank:
images


Is there a simple way to do this?

Thanks in advice.

PS tell em if I am being unclear!
 
You've not given much detail.

Are using GML?
Are the mirrors placed by the user?

If no to both, I might be able to help.
First, separate each side of the mirrors into separate objects and place them back there again, make sure that 'delete overlapping' option is off. Have it so the beam object has hit tests with all rotations and sides of the mirrors. When the beam collides with object X, just have it change direction, by stopping in place first (I think that is the red move option, value 0, middle square activated) then have another which assigns the the correct direction, ofc have the value for that equal the projectile movement speed variable (if not, make one. Its a good habit to get into).

And that should do it. Sorry if my explanation is a bit vague, I'm working from memory of when I used GM8 for a similar thing (the user placed arrows on top of wall blocks, when the character collides with a wall, if it had an arrow, it would go in that direction, if no arrow is present, the character stopped.)

You might be able to get away with just the second red movement one, I can't remember if you needed to stop first. But you would know that. If the user can place the mirrors, or that they are dynamically created (with the dynamic system you've made yourself cus I would not know how to make one) then you can simply place the older objects, and have those older objects create the new mirror-half objects and then deletes themselves.
 
Hello and thanks for the reply. I meant pre-made levels made by ME for a game with pre-made and pre-placed mirrors, that you have to use to complete level(s). Say for example I want to turn the laser cannons firing laser(s) or turn the mirrors.

THATS what I want.
 
Hrm, So the player rotates said items to solve the level?...

That's easy with the cannons'; each time you click on a cannon it would replace itself with the cannon object for the next 90 degrees angle. Using my method with the mirrors is... a bit more complicated...

Let me guess, there's something like a design phase and an active phase?... If so, using the old mirrors (that had both halves, and creates the halves then destroys itself when the active stage begins) could just have an on click feature like the cannon, to switch between. If you wanted dynamic rotating, say, combining the active and design phase in one... I can't help you.
In the method I mentioned, you can easily allow the player to try again with the restart room command.
 
Sorry the cannons are FIXED. But the mirrors can be clicked (rotated) to change the direction of laser beams. SO that they destroy OTHER cannons etc.

THATS what I want

thank you very much:)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top