keepee's Forum Posts

  • sounds cool,

    there is an expression called 'loopindex' which returns the index of the current loop.

    Indexes begin on zero.. so the first index of the loop is 0, the second is 1 and the third is 2 etc

    so to do something different on the third repetition of a loop, you can do:

    +system, compare two values | loopindex is equal to 2

    ->create turret etc

    to do this thing *every* three repetitions, (starting on the first) you can use the % operator:

    +system, compare two values | loopindex%3 is equal to 0

    ->create turret etc

    the '%3' makes it go back to zero on every multiple of 3

    so for example '107 % 100' will return 7

    and '541 % 100' will return 41

    and '6 % 3' will return 0

    also if you dont want it starting on the first, you can offset it like '(loopindex+1)%3'

  • 4. https://www.scirra.com/forum/construct-classic_forums_cat11.html :)

    also these are pretty vague questions,

    have you started to attempt to do any of these before asking?

  • The black box sounds like a bug to do with shaders or blend modes. Although different folders shouldn't produce this bug..

  • Here's part of a .capx that I was working on a while ago.

    It was part of something bigger so there's some unused instance variables and families and things.. just ignore them.

    Outlines

    edit: if you want them thicker just set the size of the outline object to 2,2 / 3,3 etc.. although this won't create a proper corner... To fix it, you can add a variable containing the thickness to where it sets the lines length.

  • started on this before I saw kyat's reply

    I added 3 event groups for different methods.

    The first is really simple but imprecise

    The second two are slightly complex but as precise as you want.

    They all work with multiple lasers too, so I set it to create four lasers.

    Disable/enable the groups to test them out.

    link

  • okay there'st wo reasons why

    first, using the action 'object|spawn' instead of 'system|create' also automatically sets the angle of the spawned object to the same as the parent object, which is why they were angled to around 180 degrees.. the enemies are angled that way when they head towards the player.

    so instead of spawn use   

         >system | create object 'pointRise' on layer 0 at (enemy.x, enemy.y)

    secondly you've given each pointrise the 8direction behaviour, which means you are controlling all of them with the movement keys at the same time you are controlling your ship! so just delete that behaviour from pointrise

    one more thing, you should read the manual entry about DT or Delta time...

    basically any constant movement such as "every tick > move forward 3 pixels" or "move 5 pixels at angle 270" should be multiplied by DT to compensate for any frame rate jitter. (otherwise if the frame rate dips from 60 to 30, objects will move half the speed.. which is bad)

  • not sure I understand what you mean exactly.. but if you are wanting to retrieve the total out of a number of dice instances rolled you can do so like this:

    sum = 0   (local variable)

    +For each Dice

         >add Dice.result to Sum     (result being the dice roll, 1-6)

    however if you literally do want dice instances to have different values (I'm not sure why?) there would be a number of ways to do so with a private variable

    for example

    Dice.ID can be numbered 0,1,2,3..

    and in the events, after generating a random number 1-6 you can do:

    set Dice.Result to Dice.Result+(Dice.ID*6)

    That means dice with an ID of 0 will return 1-6.   an ID of 1 will return 7-12, an ID of 2 will return 13-18 etc etc.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • no worries

    you can read up about repeat loops, and token() expressions in the manual. They'll explain it better than me

  • There's a similar way you can make a toggle switch:

    +on enter pressed

         >set Cheat to 1-Cheat

    This will make Cheat flip between 1 and 0 on every press

    Anyway, that tutorial wasn't really clear at all.. so I made a cap, it also checks to see if the typed word matches any of the cheat words.

    link

  • One last bump then I'll let this die.

    I feel like the only way to do this is if there was a way to group layers and set the 'force own texture' setting for the group.

    That way I could have main and lighting layers rendered seperately from the background layer. With lighting set to 'source atop'.. thus keeping the transparency where there is no objects.

    I get the impression this is how other games would get the effect, but i'm no programmer so i'm not sure.

  • Justified text (where the spacing is adjusted to make the left and right sides flush), isn't possible unless you make a plugin..

    Well it is possible without, I guess.. you could use a separate text object for each individual character (but that's a bit crazy so don't bother)

  • to get the Y velocity you just need

    object.physics.VelocityY

    to get the Velocity regardless of direction you can do:

    sqrt( (obj.physics.velocityX^2) * (obj.physics.velocityY^2) )

    or alternatively you could just do this trick:

    distance(0,0,obj.physics.velocityX,obj.physics.velocityY)

  • shameful bump

    also i've just noticed I accidentally put the gray sprite on the background layer, (it's meant to be on main), I updated the file.

  • Another method is to actually put the Car into a family (just call it 'FCar' or something)

    and then you can have a condition which picks what Car(s), and another to pick what FCar(s) specifically, even though they are the same object.. it's just a way of differentiating two separate 'pickings' for the same set of actions.. (so you can have one action that only applies to the picked Car, and another action that only applies to the picked FCar)

    This way's a bit confusing though, it sounds like your way would be all that's needed for the task.

  • +On start of layout

    >Bomb Destroy

    alternatively, place one instance of each object into a separate layout simply called 'all objects' that way you don't need any in a game level layout.