Mylon's Forum Posts

  • OnSuspend is for when the user alt-tabs. It might be called when they close, but it will also be called very frequently.

  • I'm making an idle game. A typical feature of these games is that you can close them at any time and progress will be saved. How do I get this behavior? "on end of layout" event is not when the window is closed, making this an unsuitable trigger.

  • Alright, so my "set css value "color" to ""rgb(" & int(255 * (1-(Heroes.HealthCurr/Heroes.HealthMax))) & "," & int(255 * (Heroes.HealthCurr/Heroes.HealthMax)) & ", 0)"" code works in Internet Explorer to change the color of the progress bar based on it's current progress, but this doesn't work in Chrome (because of the use of #HealthBar::-webkit-progress-value makes it more difficult to get in there and dynamically change the style.

    Is there away to reference the property or am I going to need to edit the progressbar plugin?

    Edit: There doesn't seem to be a way to change the ID of an object. Even if I define 4 possible styles for my progressbar, I have no way of changing the ID to take advantage of those styles.

  • Noncentz705: That link gave me the info I needed, thanks.

    this is how my CSS looks:

    #HealthBar {
        background: #333;
        color: #0f0;
        border-radius: 6px;
        height: 24px;
        width: 65px;
        padding: 2px;
    }
    
    #HealthBar[value]::-webkit-progress-value {
        background: #0f0;
        border-radius: 6px;
        width: value
    }
    
    #HealthBar[value]::-webkit-progress-bar {
        background: #333;
        border-radius: 6px;
    }[/code:2dkw10qy]
    
    And that gives me the rounded edges and the desired color.
    
    Thank you so much for your help with this, by the way.  I'm learning a lot about CSS.
    
    Now the question is, how would I edit "#HealthBar[value]::-webkit-progress-value" element to change color using the event system.  I would like it to fade from green to red as health drops (akin to something like ""rgb(" & int(255 * (1-(Heroes.HealthCurr/Heroes.HealthMax))) & "," & int(255 * (Heroes.HealthCurr/Heroes.HealthMax)) & ", 0)""
  • Alright, I got the css file loaded in the game! I guess it's important to note that the "set web font" isn't specific to that text element. It allows the css file to be applied universally to the layout.

    But now I'm running into a roadbloack. I can't figure out what the sub-element is called (that is, the portion of progress that is full) so that I can modify the style. Using the code I posted earlier, I get this result: http://imgur.com/L93asUL It seems there may be a third element too, the background of the progress bar itself.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Noncentz705, that one requires r209. Maybe you could show off the relevant events with a screenshot?

  • I'm aware of the "set css style" action, but I'm not familiar with what elements are available. For example, this site has some code for a fancy progress bar:

    http://stackoverflow.com/questions/7190 ... ml-and-css

    This is also a good example of something I'd like to do, done slightly differently:

    http://jsfiddle.net/cwZSW/1502/

    Like if I try to do "border-radius" I don't get any affect. If I add background-color of #0f0 and a border, only the border is the expected bright green and not the actual filled portion of the progress bar. Basically, how do I get the results from the link?

  • "pick lowest" only lets me pick instance variables, it won't let me pick by instance properties.

    Edit: Ooops, I goofed on object creation. But the "pick by ordered" then exit loop works.

  • I'm using a hex tile map where the tiles have a height value so I can't just use the tilemap object vanilla style so each row has its own tilemap instance. Well, to operate on this tilemap I'm going to need to need to figure out Y coords by picking specific tilemap objects.

    For example, to make the map bigger, I want to create a row on top of the highest one, but I need the y coords of the highest (lowest y value) instance. How do I pick this instance?

  • Hey Rex, you have a great plugin and you seem pretty active. I'm surprised I hadn't found this sooner.

    I'm creating a project using Kenney's hex tiles (they have a height) and I was wondering if you think your plugins/behaviors would be a good fit:

    http://imgur.com/9BJizyB

    At the moment each horizontal tile is it's own tilemap and I plan on using a helper function to pick my x,y. I would like to also use the Z axis but that would get even more complicated with this system.

  • Okay, since you wanted a demonstration:

    https://dl.dropboxusercontent.com/u/552 ... yDemo.capx

    Sprite 2 exists and I can reference it's height/width just fine. Sprite 1 only exists in Layout 2, so when I create it in Layout 1 it's Height is 0 at the time of creation.

    This is the kind of stuff that needs to be better documented. This is not a "personal" suggestion, but something I would add to in a wiki, nor does it need to be used with caution. It's simply providing information about what I can and cannot do in the engine, not a suggestion.

    Just like the mouse cursor: Placing the mouse sprite in layout 2 is not enough if I wish to set the cursor to that sprite in layout 1.

    Ultimately my goal is to create a scrollable list populated with sprites. I've done it in events. It's a bit messy, but I think I have the execution mostly done. For optimization, I think I may have better results keeping a copy of every object and moving them instead of creating/destroying.

  • Kyatric

    The specific block I was trying to do (I've since amended it):

    Create object "Hero3" on layer "UI2" at (ScrollboxList.x, ScrollboxList.y + Hero3.Height/2 + UIMARGIN) on Layout 1.

    I have a copy of "Hero3" on Layout 2, but the sprite still gets fixed mostly at the top of the list (ScrollboxList has the origin set to the top middle) instead of wholly enclosed within ScrollboxList as expected, suggesting that Hero3.Height = 0. I since replaced it with a flat number. This is only a problem for the first item in the list because I then use an instance variable ScrollboxList.CurrentElementY += Hero3.Y + Hero3.Height and that replaces my create Y coord. This works so long as all of my Heroes are the same height.

  • tgfcoder That sounds like a great idea, Thanks!

  • Containers: Families cannot be part of a container. If all family members require an object, that object needs to be created and picked manually (often through an family instance variable).

  • > Create Object: At the time of object creation, it doesn't have a height or width.

    >

    That's absolutely untrue. It uses the height and width of the first instance created in your project.

    The object must need to exist on the layout in question, not merely in the project.

    The game idea I'm working on relies on a relatively simple layout that grows increasing more complex over time. Unfortunately this seems to create a lot of quirks, like sprite height not having a value because all of the assets are "preloaded" on a second, unused layout.