want to change the angle of light ray. when it hit mirror

0 favourites
From the Asset Store
Immerse your quiz games with our 6 unique music loops, ranging from acoustic chill guitar to cute and upbeat style.
  • hi folks,

    i am making a game in which my ray light is doing in a direction and on placing the mirror in the path of light, light changes its direction .

    please help me, how can i change the angle of light on placing the mirror in path.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It depends on the game.

    In a puzzle game like this you can add an instance variable reflectAngle to the mirror sprite and set its value to -90 or 90.

    When ray hits the the mirror, set ray angle to (ray.angle+mirror.reflectAngle)

    If the game is something like this one, you'll need to calculate the angle depending on the angle of the mirror sprite.

    Or if your ray is short and has Bullet behavior, simply set "Bounce of obstacles=yes"

    There are also a few plugins that can be useful:

  • hi dop2000,

    thanks for your help. my game is puzzle game. i tries your logic but it is not working for me. Angle of ray is changing from its initial position. i request you to please share the construct 2 project for that , if you have.

  • You need to share your project, because I don't know what kind of game you have in mind.

    If your laser is one continuous ray as in this example, then you should make it with many individual line sprites. Each sprite is a short line, you spawn it at each mirror, set the correct angle, and change its width to the distance to the next mirror.

  • hello,

    please find the filefrom this link dropbox.com/s/4jum46c190p79 ... .capx?dl=0

  • Your link is broken.

    Try posting it without the "https://" and make sure it's not get shortened.

  • please find this link. is this link woking.

  • i think , my reputation is lessthen 250. so i am not able to send you link on this forum. are you on skype. i can send you the link or file there.

  • You really need to read a few tutorials and look at some examples of other people's projects.

    This will save you a lot of time!

    You should not create dozens of identical sprites! This is the biggest and most serious problem with your project. Don't do this!

    Create just one sprite and make lots of its instances.

    Learn to use instance variables.

    Learn to use functions.

    Define correct collision polygons and image points in your sprites.

    I fixed some of these issues in your project and optimized your code a lot.

    As for the ray reflection, it still needs some work, I didn't have time to finish it. See my comments in the event sheet.

    I don't think Light plugin can be used in this game, so I removed it.

    Here is the capx:

    https://www.dropbox.com/s/879vyvyxsxi0g ... .capx?dl=0

  • Please reload the capx, I made some more changes.

  • thank once again for helping me

  • thank you very much for your help and support without any consideration. it helped me a lot.

    i am very new in construct 2 . thats making game in messy way. but i will keep all your points in notice while making games.

  • you can choose other parameters to choose the angle of shock and use a tileset with the 4 positions so you only work with 90 degrees

  • NECRONOMICRON

    It's a completely different kind of game. The light ray is moving (growing) slowly and you need to place mirrors on its path. And all this in isometric projection.

  • hi folks,

    i am making a game in which my ray light is doing in a direction and on placing the mirror in the path of light, light changes its direction .

    please help me, how can i change the angle of light on placing the mirror in path.

    LOOK...https://www.mediafire.com/file/m5cjbacbjbghbmy/ESPEJOS.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)