Grimmy's Forum Posts

  • Lets say my map gets created procedurally using advanced random and setting the tiles with the tilemap brush (eg set tile with brush) meaning that everything within the map area looks nice and connected.

    However at the edges of the map area (lets say it 512 by 512 tiles for arguments sake) I want them to loop seamlessly with the opposite side so I can effectively infinitely loop around the map if my character continues to move in any direction.

    How would I do this part?

    Tagged:

  • I have my css file already loaded up but I want to replace some old class name with a new name. Is that possible?

    Maybe something like this but I dont know how to access the css text itself..

    innerHTML.replace(".someClass",".newClass")
    

    ;

    Cheers

    Tagged:

  • Im actually using an external tool to visually create the css and html. Its perfect for complex html interfaces all but for this little issue that it uses a body tag.

    In an attempt to fix the issue Im trying to automatically rename the tag in C3 at runtime. I can do this fine for the html using the 'set html content' action but there doesn't seem to be a way to edit the .css file via script.

    Is there some javascript that can replace the css class 'body' with a class 'div'?

    Cheers

  • On export my html reads:

    <body class="body-1">
    

    and the style is...

    body.body-1 {
     position: static;
     display: block;
    ..etc
    }
    

    But if I change these to the following it works fine.

    <div class="body-1">
    

    and the style to:

    div.body-1 {
     position: static;
     display: block;
    ..etc
    }
    

    Can anyone explain why and is there a better way to get around this rather than having to change the body tags to div tags every time I export? Thanks

  • I have a html element with lots of sub containers and classes. When I run it in C3 everything works fine apart from the bottom most (parent) container does not display. In my case this should display just a bright green background with a 20 pixel border.

    All of the child classes display perfectly (buttons, text etc) but for for some reason the background container is nowhere to be seen.

    When I run it as a html preview in the browser the background is visible but when I run via construct 3 it is not visible.

    I tried using a wrapper class around everything as described in the docs but this had no effect. Does anyone know what could be going on?

    Thanks

    Tagged:

  • I have a HTMLElement with lots of things going on inside it. One of those things is a range slider with an id of 'slider-1'.

    I want to change a value (some variable) in the event sheet when this slider has been changed. I can see there is a htmlElement onClicked event for buttons which works great, but I can't find anything for a slider.

    How would I do this?

    I tried the following javascript snippet. It does nothing but I have a feeling I might be on the right track ...

    var slider = document.getElementById("slider-1");
    var textElement = document.getElementById("val-1");//a text element to display the current value
    
    slider.addEventListener("input", function() {
     
    	var sliderValue = this.value;
     textElement.textContent = sliderValue;
     
    });
    

    Thanks

    Tagged:

  • Im trying some advanced html tricks but Im getting this error when I run my game due to one of my html elements has the following section of script was part of its html body:

    <script src="jquery-3.7.1.min.js"></script> <script src="jquery-ui.min.js"></script> <script> $(document).ready(function() { $("#Tabs1").tabs( { show: false, hide: false, event: 'click', collapsible: false }); });

    The jquery source files are in the Files directory but I also tried them in scripts but I still get the same error in the console.

    Any ideas? Maybe Jquery isn't supported?

    Im actually trying to create a tabbed interface but when I bring it across all the styling is lost.

    Thanks

  • Thanks, but really none of that makes any sense.

    -Choosing HTML would NOT make an interface look like a website.(unless you wanted it too)

    -If I choose html over traditional C3 objects then yes, programming approach is completely different. One uses html, css and javascript and the other other uses uses traditional C3 coding and the layout view visual setup (Scene graph hierarchies etc).

    There are various advantages and disadvantages for each but I'm starting to think that html is now the better option.

    As of the update yesterday(r369), the html object got a significant update allowing us to us html layers 'under or over' traditional c3 art layers. This makes the html approach even more appealing.

  • Can I bump this one? I d like to get some feedback on any experiences people may have had. HTML or C3 hand rolled?

    Cheers

  • Thanks so much for this. Very useful! I tested it and ran into a slight issue. The code you sent doesn't account for the # character so if your hex has a # character the resulting colours will be very green.

    If your hex numbers contain # symbols you might want also to add the following line to trim it from the string first:

    set hex to replace(hex, "#", "")

    This way both formats will work. eg 0000ff and #0000ff

    I have attached screenshot..

  • My Javascript function changes hex values to rgb like so:

    localVars.gotColour = hexToRgb("#bceadf");
    

    The function is returning an object which contains rgb values like so.

    return {r, g, b};
    

    But how do I get theses into the event sheet as something useable? The gotColour variable is an object with the 3 variables inside, but I cant seem to use it for anything useful. (apart from printing object r:12, g:34 b:34 to the console)

    I would have expected I could do something like the following in the event sheet after the function had been run:

    Set Colour to gotColour //does nothing

    .or this..

    Set Colour to rgbEx255(gotColour[0],gotColour[1],gotColour[2]) //bad syntax

    ..but those do nothing....

    I guess I could write 3 different functions to each get the r,g,b values individually but that seems very messy.

    Any tips?

  • I want to import colour palettes from a JSON file and I find it much tidier to have a single hex value to represent each colour rather than an array of 3 different values (rgb).However, I can seem to find any way in C3 to set colour using Hex values(in code)). (only RGB)

    I figured the best way would be to write a little converter in Javascript, but even though I have the new converted values as an array (eg rgb_array = [r,g,b];) I dont know how to get this back from my Javscript into construct. I can only set values of variables in Construct that are strings, numbers or booleans.

    Cheers

    p.S I tried the plugin called 'CONVERTERCOLORJS (AIOUTE GAO)' but using the following:

    Set Color Colour_Converter.toRGB("#e4646e")

    Didnt do anything to the colour.

    Tagged:

  • The answer is:

    anglelerp(Self.Orbit.Rotation,new_angle,lerp_speed)

    Although it would be nice to know how to do it with a tween so I can get more control over the easing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I want a sprite to orbit another sprite by setting the orbit rotation (in orbit behaviour) every frame, but I want the orbiting sprite to smoothly ease to its new position. How do I do this?

    I have tried create a value tween in the update loop and then assigning that value every frame to the Orbit.Rotation value but that seems to make a bit of a mess.

  • The answer is to Tween the property Angle. (Add a tween behaviour) and use...

    angle(Self.X,Self.Y,Mouse.X,Mouse.Y)

    ..as the tween end value