ComGamer's Forum Posts

  • Hi,

    Wich is the property name of the background-color on hover in a dropdown list (list plugin)? The standard color is blue, but I want to change it. I successfully changed font, color, ... with 'Set CSS style' so I know how to do this. Finding property names of common properties is no problem, but I can't find the property name of the background anywhere because it's not a standard property.

    Screenshot (I want to change the blue):

    i.imgur.com/lwXPRTs.png

    Screenshot of my code to change the style of the list:

    i.imgur.com/9Yim8Ne.png

    Thanks!

    Wim

    Tagged:

  • dop2000,

    Thank you very much! This is such a good and simple solution.

  • Hi,

    I want to change the animation of a sprite that is spawned as a particle, but this doesn't happen immediately.

    I've build a small test project to show the problem (also see screenshot below):

    https://github.com/WimDeBacker/WimDeBacker/blob/WimDeBacker-TestSpawnSprite/TestSpawnSprite.c3p

    Setting the particle object to the sprite is done immediately, but then changing the animation of the last spawned sprites doesn't work. The animation of the sprites that where spawned the previous mouseclick change like expected (become red in the example), but the last spawned sprites stay green.

  • Thank you very much! Both your solutions are almost the same now.

    Wim

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Dear Maverick1912 and dop2000,

    Thank you for your answers!

    The method of Maveric1912 seems the best of the two answers to me.

    Maverick, do you have a .c3p file of upbeat-payne-96f97b.netlify.app ?

    In the solution of dop2000 recalculating the sectors for every possible angle seems very complex (e.g. every quadrant needs a completely different polygon)

    Thanks!

    Wim

  • The problem is that the DrawingCanvas object doesn't have an Arc-function. (I just added it to the feature requests.) That would probably be the easiest way, but isn't available for Construct3 (why??). It was available in Construct 2 and there's even a nice tutorial: https://www.construct.net/en/tutorials/draw-slices-dynamically-label-1295.

    Some requirements for the arc/pie:

    - Pixel-perfect alignment with backgroundpicture in the project.

    - The pie must change every second because it's a kind of clock.

    I tried:

    - iFrame and use the Arc function of the Canvas, but aligning the arc with the background picture and make this work on every platform and screen size seems to be very complex.

    - I thought that maybe by using scripting, I could get the context of the DrawingCanvas and use that to draw the arc, but 'GetContext' isn't available as a method of the Drawing Canvas Script Interface.

    Thanks!

    Wim

    Tagged:

  • Oké, thanks! Now I can put the sound into Binary Data and save the Binary Data to LocalStorage.

    What I can't get working:

    1. loading the data from LocalStorage into BinaryData,

    -> LocalStorage: Get item "audiofile" into BinaryData

    The length of BinaryData stays zero after:

    + LocalStorage: On item "audiofile" get

    -> Text: Append "equal?: " & BinaryData.ByteLength

    2. How can I put this BinaryData somewhere I can access by a URL, because a URL is what the audio-object needs "add remote URL". Or is there another way to put the BinaryData into the Audio-object?

    Many thanks in advance (and sorry for my unclear English)

    Wim

  • Maybe I can just always reload the file from the local drive, but then I need the path to the file. Is there a way to get the path to the file from FileChooser? I can get the name of the file, but not the path.

    Wim

  • I want the user to be able to select an audio file (ogg) from his local drive. Then saving the game and replay the audio file the next time the user opens the game.

    When opening a file with FileChooser it returns a URL to the file. I can use this URL to play the audio (audio Add remote URL).

    I can save this URL, but next time I open the game the audio file at the URL doesn't exist anymore.

    So I already figured out I don't have to save the URL but the audio-file itself.

    I tried with LocalStorage, tried to convert it to BinaryData, ... but can't fetch the data of the audio file.

    My project: drive.google.com/file/d/1eFghbP7HwMKFULSJ_78zX5QiwOzqmp5u/view

    Thanks!

    Wim

  • Is it possible to open a local (on Windows & Android) audio file and play it?

    With the FileChooser I can "load" a sound, but how can I play it?

    Wim

  • Hi,

    I want to draw on a html canvas:

    const topCanvas = document.createElement("canvas");

    document.body.appendChild(topCanvas);

    But the canvas is always positioned on the window and i can't find a way to position it relative to the viewport or layout:

    topCanvas.style.position = "absolute";

    topCanvas.style.left = "10px";

    topCanvas.style.top = "10px";

    topCanvas.style.width = "500px";

    topCanvas.style.height = "500px";

    thanks!

  • Ashley,

    I'm sorry I did not make myself clear (my last reply contained your solution not mine):

    - These are no onkeypressed functions in my layoutspecific eventsheets.

    In the common eventsheet there are 8 onkeypressed functions, but on the layout-specific eventsheets there is only one 'function that does all the action' with the 'keyboardkey' as parameter.

    So there are no duplicate functions in my example.

    Number of functions in the project:

    - Your solution:

    (3 layouts) x (8 'onkeypressed functions' + 1 'function that does all the action')

    = 27 functions.

    --> a lot of duplicated code

    My solution:

    (8 common onkeypressed functions) + ((3 layouts) x (1 'function that does all the action'))

    = 11 functions.

    --> no duplicated code

  • Fengist, Ashley, Thank you!

    Fengist: I'm not a native speaker, so I miss the subtle difference between English words, but 'functional' is indeed a better word to describe what I want. :-)

    So I have to put all keyboard events in all layouts. In my project this seems like a lot of double code. Maybe I made my example to simple, so I try to explain myself better:

    - I'm making a game for children with a motor disability, so they have to access it by keyboard.

    - It's a game about recognizing colors.

    - They can choose a color by the corresponding key (r: red, g: green, y: yellow, p: purple, ...).

    - On layout1 when they press 'r' a red balloon pops.

    On layout2 when they press 'r', the red airplane makes a loop,

    on layout3 when they press 'r' the red helicopter flies away, ...

    - So every layout contains a keyboard event and a corresponding function:

    My current "common Eventsheet" contains:

    Keyboard(On [r] Pressed) -→ keyPressed(Red)

    Keyboard(On [o] Pressed) -→ keyPressed(Orange)

    Keyboard(On [g] Pressed) -→ keyPressed(Green)

    Keyboard(On Pressed) -→ keyPressed(Blue)

    Keyboard(On

    Pressed) -→ keyPressed(Purple)

    Keyboard(On [y] Pressed) -→ keyPressed(Yellow)

    Keyboard(On [w] Pressed) -→ keyPressed(White)

    When I define this in every layout I get:

    On ES1:

    Keyboard(On [r] Pressed) -→ keyPressed1(Red)

    Keyboard(On [o] Pressed) -→ keyPressed1(Orange)

    Keyboard(On [g] Pressed) -→ keyPressed1(Green)

    Keyboard(On Pressed) -→ keyPressed1(Blue)

    Keyboard(On

    Pressed) -→ keyPressed1(Purple)

    Keyboard(On [y] Pressed) -→ keyPressed1(Yellow)

    Keyboard(On [w] Pressed) -→ keyPressed1(White)

    On ES2:

    Keyboard(On [r] Pressed) -→ keyPressed2(Red)

    Keyboard(On [o] Pressed) -→ keyPressed2(Orange)

    Keyboard(On [g] Pressed) -→ keyPressed2(Green)

    Keyboard(On Pressed) -→ keyPressed2(Blue)

    Keyboard(On

    Pressed) -→ keyPressed2(Purple)

    Keyboard(On [y] Pressed) -→ keyPressed2(Yellow)

    Keyboard(On [w] Pressed) -→ keyPressed2(White)

    ...

    Is this the most functional way?

  • blackhornet

    Thank you, but the problem is that the functions are more complex than this, I've drastically simplified it. In your solution the ES_common has to know what's going on in L1 & L2.

    ES_common has to make a 'generic call' to the corresponding functions in the other eventsheets.

    The corresponding functions can do a lot of different things like creating new sprites & particles, destroy sprites, ...

    Both layouts are a kind of 'mini-game' which are very different, but every layout uses the same keyboard keys.

    Wim

  • Is mapping the function to a string the simplest way?

    ES_Common:

    + System: On start of layout

    -> Functions: Map "mymap" string "moveSpriteL1" to moveSpriteL1

    -> Functions: Map "mymap" string "moveSpriteL2" to moveSpriteL2

    + Keyboard: On Space pressed

    -> Functions: Call function from "mymap" map with string "moveSprite" & LayoutName (forward parameters from index 0)

    ES1:

    * On function 'moveSpriteL1' -> Sprite1: Move forward 20 pixels

    ES2:

    * On function 'moveSpriteL2'-> Sprite2: Move forward 20 pixels