nutmix's Forum Posts

  • Excellent info, thanks!

    I'll try both options

    +100 credits to ramones & Yann.

    Cube maze is cool - the voiceovers are excellent too.

  • Ok, tried the demo app on his page: funstormgames.com/blog/2012/01/construct-2-log-to-chrome-console-plugin

    With FF 14.1 and it doesnt seem to work, just get lots of warnings like this:

    Timestamp: 19/08/12 11:43:17

    Warning: Error in parsing value for 'filter'. Declaration dropped.

    Source File: funstormgames.com/blog/2012/01/construct-2-log-to-chrome-console-plugin

    Line: 0

    I guess its time to install chrome <img src="smileys/smiley23.gif" border="0" align="middle" />

  • *edit* Aye, the plugin works beautifully, it's only the example that is broken in the current build. Looks like there's a problem with Div buttons.

    Hi Julmust, just out of interest, what is a div button? I use sprites as buttons which is missing some buttony type behaviours such as the ability to set inactive/disabled. I saw the form controls-> OK Button, but its pretty ugly.

    Anyway, Im going to try that debug plugin as it works in FF <img src="smileys/smiley1.gif" border="0" align="middle" />

  • use the same object and put the graphics of "on" and "off" state in frame 0 and 1

    on click on button -> set frame to 1-self.frame

    Great suggestion.   I added a second frame to my on button graphic with the off button graphic. So now it has two frames.

    This:

       on click on onButton -> set frame to 1-self.frame

    says "frame is not an expression or instance variable in onButton"

    so I tried this:

    on click on onButton -> set frame to 1-self.AnimationFrame

    But now when I launch my game, it imedialtly jumps to the second frame, even though I havent clicked on anything, and the "initial frame" is set to 0.

    Is this normal? how do I stop it animating and runing through the frames on its own?

    I tried resetting the frame to 0 in the "on loading finished" and in the "on end of layout", but it still comes up showing frame 1 after the game has loaded for the first time. After thay, your frame toggle works fine.

    Any ideas?

    Thanks!

  • ok you can use groups , for example group for making clickable and group for unclickable and so on... (by the way i didn't read your topic because i'm busy ^^)

    Thanks for the info, but how do grouping events (which I guess is just for readability?) help make objects not respond to clicks? In most programming languages, you would say object.enabled = false, but constuct 2 doesnt have this. Thanks, and sorry for beeing a complete beginner.

  • Ok, I found a simple way to hack actions into a event sheet so I can use it as a GOTO - use a condition which is always true, e.g. System-> layer 0 is visible.

    So now I swap the button on the layout with the other botton way off the layout by including the swap script at the end of each buttons onclick event handling.

    But now I get the weirdest of behaviour: the newly swapped in button also gets clicked event!

    So I click once on an object, and in the onclick event for that object, swap the objects X&Y with a completely differetn object, and the new object also gets an onclick event, even though there has been no click on the second object.

    Is this a bug do you think?

  • When you use the Fade behavior "start fade" the object becomes invisible.

    I am having trouble making it visible again. I tried setting it to visible, didnt work, tried setting its opacity to 100, get strange effects.

    Does fade work on opacity only, or does it set the "visible" flag, or some other mechanism?

  • I just tried option 3), but its not tennable.

    I need to swap the buttons over in many places. Its not going to be maintainable to duplicate the button location swapping code in every place its needed.

    As there are no custom events which can be triggered, the alternative is to create the construct 2 equivalent of a GOTO: include an event sheet. However, in a new event sheet, there seems to be no way to populate global variables with buttons X & Y coordinanets (i.e. the system event has no "set global variable" option.

    I could of course hard code the "off screen" buttons coords, but this wont lend itself to the many different screen sizes I'll need to support.

  • In a normal programming language, I could either:

    1) put print statements in key places to see if they are being called.

    2) step through with a debugger.

    How does one do debugging in construct 2? E.g. is there a way I can add a print statement to output to a console as an action? Or some preference to log every event?

    E.g. To see which events are being triggered, or to know what the instance variables are.

    I guess I could reserver a space in the game gui for debug comments, and use set text on that, but this is pretty invasive.

    Any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have two buttons, each is a sprite. I have one directly on top of the other, in different layers. They are more or less one button for "on" and one button for "off". You should only see and be able to click on one of them at at a time - like a toggle.

    My first attempt I had them both in the same layer, and made one invisible by default (.e.g off). So the player only sees "on". When he clicks on the "on" button, I still get an onclick event on the off button, even thouh its invisible.

    So attempt two, I tried making the active button on a higher layer, and visible, and the inactive button on a lower layer, and invisible. However, both buttons still seem to get pressed.

    I see a few options:

    1) destry and create a new button each time one is clicked, so only one button is active at any time.

    2) Keep a button state global variable, and ignore the unwanted button events

    3) I could try and move the inactive button off screen to try and make it unclickable, but I dont know what affect this will have on the layout in a browser.

    I didnt see in the manual an explanation on how events pass down through layers. Has anyone seen such an article?

    Any suggestions?

    Many thanks!

  • Brilliant responses, and several options. In the end I went with making copies, rather than clones, and giving each one an ID instance variable as suggested, then using several for each loops. Ill try the UID option when get I more time.

  • Wow, thats a very useful feature - the manual should include this in the sheets page!

    I had no idea you could create a sheet, with actions with no event conditions, then call it as an action!

    +100 credits for Shinkan.

  • Im used to event driven frameworks like Actionscript and Flash.

    I am trying to figure out how to raise/handle a value change event.

    E.g.

    You have a global variable called chipBalance.

    The balance is updated in several places (e.g. start game deducts from it, winning adds to it).

    You only want to update the balance on the screen when the value changes. You certainly dont want to poll the value every tick (for lots of events, this will kill performance, and is poor solution). You also dont want to duplicate the code to update the balnace on the screen in every place where the blance can change - you need an event!

    I cant find it though. Anyone know how to do this without polling very tick?

  • Hi Shinkan, I dont see how having mutliple event sheets can simulate raising a custom event in several places a single game? My understanding from the manual: scirra.com/manual/121/event-sheets

    is that they are just like include files if you want to include your events in multyple games (I only have one game).

  • I guess another way is to create a polling effect, e.g. set a global variable called "gameEnd" to 1 to "raise" the event, then every tick compare the variable to 1, and if it reaches 1, do some action and set it to 0. The problem is that events could be lost because Im guessing there is no mutual exclusion on the variable.