0 Favourites

Multiple Instant-Hit Lasers

This forum is currently in read-only mode.
  • So I made a simple constant-stream laser turret that shoots vertically. I used the instant-hit laser tutorial to set it up. My goal is to have more than one turret and each laser-length will be set independently. What I have working: two lasers on-screen (or more) with independent lasers and independent ending markers for calculating the length. They're the white dots floating in the air above each laser (tough to see). I want the player to 'break' the beam and shorten it. Simple enough, but assigning to multiple lasers independently alludes me completely.

    What currently happens: If the player enters the beam on the left, both lasers lengths are shortened. If the player enters the beam on the right, nothing happens.

    What I want: Each laser should be adjusted independently. I haven't a clue how to achieve that.

    A shot for reference:

    <img src="http://img.photobucket.com/albums/v625/CubedOCR/Blight/help1.jpg" border="0" />

    My current events:

    <img src="http://www.adamprack.com/help2.jpg" border="0" />

    vert: the turret thing

    redbullet: bullet behavior object, instant-hit, invisible

    rayend: set to last point of bullet, for judging distance

    laser: duh

    Sprite: player character

    Any help is appreciated!

  • Haven't much time right now, but you said you want make each laser independent, but in your event is a global var. For independent actions, I only use private variables. So when the player overlaps a bullet and global var is 1, it destroys the bullet. That condition always goes for every bullet because the variable has to be a private one.

    I would use the sprite that spawns the laser ingame, and that one spawns the bulle. And set floating to a private variable of that sprite.

    Only work with global vars if your action also should be "global"/"'un'independent", for everything.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • That global variable 'floating' isn't related to the length. That is only used to determine if the player should get hurt or not (the player has a shield below them at times). I don't use that variable in determining laser length. It can be ignored for the purposes of this. Even with private variables, I'm not sure how I'd achieve it, but I suppose I can try a few things more later on tonight.

  • if you could make a small example .cap that shows the error, I can help you real quick.

  • I had a similar problem while developing final stages in Rules of the Shadowrealm. Make an example.cap and I'll try to help you too.

  • Here's a barebones .cap to show the issue.

    www.adamprack.com/laserfix.cap

  • It's just one way to do it. Maybe someone else has a better one.

    https://dl.dropbox.com/u/26932498/laserfix%20%282%29.cap

    edit: you don't have to put the laser itself and the rayend if you place a "vert" sprite. I've put them in one container. You only have to set a vert somewhere and the laser/rayend creates automaticly.

    Just the first laser has to have all sprites, since they have to be at least 1x at the layout to exist^^

  • Hey, nice example zyblade! That was exactly my solution form Rules of the Shadowrealm!

  • Hi there is an example...

    Lasers.cap

    Get fun!

    PD: Blight looks nice! good job!

    Sorry for my english ^_^

  • Awesome, thank you all very much!

  • Good solution with uid. I tried it with container, but for some reason it didn't worked. I thought every object that is together witin on container, interacts with that item, if I put the in on condition/action, no matter how many instances are there of them?

  • thanks zyblade, I used to think so about containers, but still now i just found it useful for creating a group of objects at once, manipulating container members as a whole still I didnt found a way to do that... however containers must to have some other usages...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Isometric multiple floors
74 9,717
eleanorawesome's avatar
eleanorawesome
Unread hot topic
46 17,520
ex32's avatar
ex32
Unread hot topic
0 Favourites
[EFFECT] Multiple FX
46 8,059
Fenix18's avatar
Fenix18