paulscottrobson's Forum Posts

  • The idea, right, is that you extend your laser until it hits something ?

    Your event 3 works, but the problem is it doesn't stop in the repeat to update everything.

    What you can do is

    At the top of 1, Laser set Width to 10 (this sets the initial size of the laser)

    Change 2 to Laser set Height to 2 (if you set the width here it will change it back every time - it goes through the events many times a second - this is the reason the sine doesn't appear to work, you keep setting it back to 2)

    Change the first condition in 3 to "System Every 0.3 seconds" - this means the laser will extend every 0.3 seconds

    Change the Set Width to Laser.Width to 5 - so every 0.3 seconds the laser will be 5 pixels wider until it hits the object.

    This is very slow but it will allow you to see what is going on.

    Construct 2 is event and timer driven. It is a different way of thinking to procedural programming.

  • Hi Mitovo. Looks nice.

    As a general (but not always correct !) rule, if you are duplicating lots of code, there's often a better way of doing it. On your "powerups" for example (event 11) the powerups would be better off in a "family", you can then address them as a unit *and* individually. Powerups are all the same things I would guess, it's only at the point where you create and activate them that they differ.

    If you want to add powerups later, then you'd have to do all this again.

    Similarly for event 21 onwards - you could move the bullet-destroys that are repeated in 22-25 into 21 as you don't ever use them. You can't move UFO.destroy in there, because you need the positions, but because subevents (I think) operate sequentially you could have a sub event 26 which is always executed which destroys the UFO - then if you add a new powerup all you have to do is create it

    Your bullets could be moved into families in a similar way.

    Last but not least, add comments. You might remember what everything does now, but you might not if you want to fix it later on. I've been coding for years (I'm ancient) take it from me, if you don't you'll regret it

  • This is going to sound really odd. I've started using C2 heavily and I really like it , but occasionally my on screen objects in the editor sag. They look like they're drunk almost

    If you can imagine (this actually happened) a sprite font which has two clones (score and high score), one neatly in its box, the other one at the bottom of it and at an angle of 20 degrees or so. It only shows up at edit time, it works fine running and it seems to go away if I close the editor down and reopen it.

    Has anyone else seen it ? Am I drinking too much lager ?

  • Something like this http://www.viewtalker.co.uk/c2/Trees.capx - maintains a count of how many trees there are and makes them to order at a random choice from a spawning point ?

    NB: It would be really handy if I could upload files rather than FTP them ....

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, I didn't see that. It is quite small mind

  • I''m not quite sure what you want here. Are you saying you want to destroy your tree and spawn another one when you destroy it, or do you want to spawn one at a later time ?

  • Well, there's three ways you can do this (at least).

    Firstly, create them programmatically, rather than placing them on the layout with drag and drop from the C2 editor, call System.CreateObject in a for loop, then you can use loopIndex to store them in a 2D array.

    Secondly, you could give each an instance variable which is their index in the array (you could use the numbers in the text if these are containers with a sprite and text object in them) and use foreach to copy those values to an array

    Thirdly, if you know they are going to be top left to bottom right ordered, you can use for each (ordered) with an expression something like button.X + button.Y * 10000 which will order them for you in that order, as long as your layout is less than 10000 high

  • This is probably a very dumb question, but I've got hundreds of unread posts. Is there a way of marking all posts as read ?

  • Depends on how many changes of text you want. If it is only two or three you could do them as seperate animations, but if you what general text then pin a text object to it.

  • Thanks newt

  • Problem Description

    C2 appears to detect that an object is part of a container and limits any events on that object to objects in that container, but it doesn't pick it up if the object the event on is part of a family.

    I was writing a simple control that has a number, a + above it and a - below it. The idea is that the number is adjusted using the +/- buttons. I created a family Adjuster with an instance variable 'adjustAmount', which has two objects in it, AdjustUp and AdjustDown with the adjustAmount set to 1 and -1 respectively.

    The text object with the number is a container containing an adjustUp and an adjustDown instance.

    The original version (Layout 2) uses a single event to detect a touch on a member of the Adjuster family. The action is to add the adjustAmount in the Adjuster subclass to the boxValue in the Value object, and update the display.

    However, the "Value" is not limited to the one in the Container with the Adjuster object but is the whole collection of such objects , so clicking on an Adjuster causes all values to change.

    Layout 1 is identical save that there are two events, touch on AdjustUp and touch on AdjustDown , this works as intended.

    Attach a Capx

    .... how ? Can't see any upload button <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    I've uploaded it to http://studio2.org.uk/ContainerBug.capx

    Description of Capx

    Layout 1 and 2 are identical apart from the event detection on the +/- text items. The idea is that the +/- should only adjust their own value.

    Steps to Reproduce Bug

      Compare Layout 1 (works) with Layout 2 (fails)

    Observed Result

    Layout 2, both numbers are changed by any adjuster button (a +/-)

    Expected Result

    The numbers and +/- should operate independently.

    Affected Browsers

    Should not be a browser specific issue, relates to compilation of events.

    Operating System and Service Pack

    Windows 8.1 current

    Construct 2 Version ID

    205.2