AllanR's Recent Forum Activity

  • take another look at dop's example. on event 4 it sets the slider's instance variable "Value" that you can then assign to your object's effect properties.

    event 5 does the opposite - its sets the "Value" variable, and then updates the slider to represent that value - exactly what you want to do!

  • not that I know of. Are you trying to get a pixelalted look?

    you could try a webfont for the text object...

  • ok, just took another look at your original file and saw that the origin is in the middle of Slider...

    normally I would set it at 0,0 to make working with it a little easier...

    so that would change the clamp statement to:

    knob - set X to Clamp(self.X, Slider.X - Slider.Width/2 +10, Slider.X + Slider.Width/2 -10)

    (and adjust the +10 and -10 as necessary) - although image points are better, because if you scale the slider at all, then the image points will scale properly as well...

  • dop's file has an example of how to connect to a value - when you click the button, it sets the slider value to 10.

    but that could just as easily be Created_Objects.HSL_Value, or anything else...

    using image points is the easiest way to limit the knob to where you want,

    or you could adjust the clamp values like this:

    knob - set X to clamp(self.X, Slider.X +5, Slider.X + Slider.Width -5) (see below)

    (and then change the +5 / -5 values until you get what you want - Dop's example has the image points at +8 and -10)

  • if you are using a text object in C3, those a are rendered directly on the canvas by C3. They do not use CSS to define their appearance.

    if you are using Textbox and buttons, then those can be styled by CSS.

    another option is SpriteFont - which as the name implies, uses sprites to make up the text you want... so that may be a way to achieve the look you want.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • that looks awesome! :) you should add a few particles to make it look like the buildings are crumbling as they get destroyed. And post the capx so people can see exactly how you did it.

  • yeah dop's file uses image points, lerp and unlerp to position the knob - which is a very clean, concise way to do it. (Really nice example dop!)

    The way you are trying to do it will also work, but you need to include the slider's x position as well as the width.

    the lower clamp value should just be Slider.X

    the upper clamp value will be Slider.X + Slider.Width

    so the full clamp expression will be:

    Knob - set X to clamp(self.X, Slider.X, Slider.X + Slider.Width)

  • you may need to enable bullet behavior in event 54 (if you disabled it by default to keep the ship from flying off the screen at the beginning).

  • it all depends on what you are doing with the array.

    I just added a 25,000 cell array to an old tetris game I made ages ago. and set every cell to a random value at the start of layout. that made no noticeable difference on my computer or ipad.

    then looping through every single cell once a second checking to see how many cells were greater than a random number only slightly affected performance. My computer went from 60 fps to 57. My ipad went down to 55 fps. I could only tell the difference because debug mode said the fps was a little lower.

    looping through every cell every tick made it feel a little sluggish - down to 30 fps. but was totally playable. So I tried again with a 50,000 cell array (loop through every tick). The pieces fell very slowly, was getting 16 fps. The pieces rotated and moved fine - just went down the screen very slowly, so it is more of an issue of not using dt properly...

    saving a few values at the end of a level, and restoring those when you come back should be no problem. But, again, it depends what you are doing with the array, and what else is going on - how many moving objects, effects, etc.

  • your english is very good. I have helped people on the forums for years because it is a great way to learn and try out different solutions to interesting problems.

    "1 - Is there a simple solution: if the instance is REALLY close to one of the edges?"

    is there ever really a simple solution? :) you know the width and height of the panel, so yes, you can use those values to tell if it is on the screen or not. The tick is where to move it so as to not cover up the object you are trying to modify... I tested to see if "Bound to Layout" would work, but there is no way to disable that when you want to hide the panel. So that means you would have to destroy it and recreate it every time. So, it is probably easier to just calculate where to put it...

    2 - save size

    I think you will be ok, but you will want to test that out at some point. I suspect that you could add a couple thousand objects before size will become a problem. but that is just a guess.

  • the "every tick" on stage 2 does not have any effect - as long as stage is 2, the actions on that event will happen every tick until stage is no longer 2.

    the same goes for stages 1 3 4 and 5 - they will also run every tick when stage has one of those values, unless you add a "trigger once" or change the value of stage.

    in your original post you said you want the character to not be walking at the start - but how can the character not be walking if you only have a walking animation?

  • I gave it a try - as usual, there are quite a few tricky things to get right!

    thanks to rokstars322, I was able to edit your sample by deleting one of the effects from the Created_Objects family - since I don't have a C3 license yet either. All the code is there, so you can just add the Contrast effect back in to make it work...

    your disabled code was not working because you were checking for a click on Created_Objects, Selecting the object, then the next event was undoing it (because the mouse click was still true, and now there was a selected object to unselect).

    so I re-structured that whole section... (I also deleted the fullscreen code because it was running every tick and making my screen flicker)

    Having a Control Panel adds a whole new level of complexity and new problems to the logic of an object family. If the panel is over an object, any click on the panel may also register as a click on any objects below. In your case, that would cause your code to mysteriously change selected objects without you knowing why. AND if there isn't an object under the panel, then the code would think you are trying to un-select objects! (which would also cause the panel to disappear!)

    the solution I have used to fix these issues in the past is to have an object be part of the family and use it as a shield. So, I made a Panel_Shield sprite, set it to be invisible, and made it the same size as the panel, and pinned it to the panel. When ever the panel is brought on the screen, the panel_shield must be moved to the top of the layer because if there are any objects above it, you will have trouble. (or keep it on the UI layer - I had to delete layers because of free version limitations).

    the panel_shield is given a unique "ObjectType" so that we know to ignore clicks on it. It is also important to always use "Pick Top Instance" when doing any mouse button events so that the shield properly blocks clicks from objects we didn't mean to click.

    rokstars322 showed updating the Created_Objects when the slider "On Changed" trigger fired. that only updates the value when the slider is released. So, I followed your code where the value is updated every tick so the user can instantly see the effect.

    and, like Dop said, you need to store the values in instance variables in the family...

    https://www.rieperts.com/games/forum/effects.c3p

AllanR's avatar

AllanR

Member since 21 Nov, 2013

Twitter
AllanR has 23 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies