tulamide's Forum Posts

  • * To use random you need to import it prior to using it. It is the best way to import at the beginning of the script:

    import random
    
    def edgeplacement
    ...
    

    * No need for the else-part. You're switching between one of the numbers, that will be generated with randint(1, 4). 'i' will never be set to any other number than 1, 2, 3 or 4.

    * No need to explicitly 'return true'. You may safely delete that line.

    * As far as I know (but I might be wrong), random.random() isn't used as you would like to. It is used without a number in brackets and returns the next random number everytime it is called, which is a number between 0.0 and 1.0

    If I'm right, you better use randint(0, 360) here, or, if you explicitly want decimals, random() * 360

    * You don't reference an object by creating it. You need to access it using SOL (selected objects list). I can't work with CC at the moment, but I think it is something like

    System.Create(o, l, *** yy)

    newobject = SOL.o

    newobject.angle = random.random() * 360

    If SOL doesn't accept a reference, then you need to create the object by name.

  • Whatever one might have in mind regarding Apple, he as a visionary man will leave a big hole.

    I was working with macs, was teaching the use of macs, had a mac myself for more than 10 years and saw Steve Jobs doing so many interesting things. Todays MacOS X wouldn't exist, if he did not found neXt.

    And it is too young to die, no matter if your name is Steve Jobs or any other. 56 just is too young.

  • I use 5-Random(11) for cases like this.

    And it is good that you do so, because random(integer) returns floor(random), or in other words:

    random(10) produces a number greater than 0 and less than 10 (e.g. 0.024 or 9.8453) and returns it rounded down to the nearest integer (0.024 will be returned as 0, 9.8453 as 9)

    As a result, random(10) will return one of 10 numbers ranging from 0 to 9.

    -5 + random(10) would be -5 + [0, 9] => [-5, 4]

    random(10) - 5 would be [0, 9] - 5 => [-5, 4]

    to reach the full range of [-5, 5] (which is 11 numbers) you need random(11) (which returns in a range of 11 numbers from 0 to 10):

    5 - random(11) would be 5 - [0, 10] => [5, -5]

    random(11) - 5 would be [0, 10] - 5 => [-5, 5]

    -5 + random(11) would be -5 + [0, 10] => [-5, 5]

    The order doesn't make a difference, so use whatever looks good to you, just make sure the full range is covered <img src="smileys/smiley1.gif" border="0" align="middle" />

  • There were lots of threads and discussions about this. May search for them if you want to read more about it. It is the simple fact that nothing gets triggered faster than a frame. If a game runs with 60 fps, then the shortest timespan that can be distinguished is 1/60 (ca 16.67 ms)

    So your event is triggered every 16.67ms and only if at that time the timer modulo divided by 7 is 1 the event will actually be executed:

    frame 1 timer = 0 | timer%7 = 0

    frame 2 timer = 16 | timer%7 = 2

    frame 3 timer = 33 | timer%7 = 5

    frame 4 timer = 50 | timer%7 = 1 <-first executed event

    Of course, the hits will raise if in unlimited framerate, because with something like 1000 fps the shortest timespan is 1/1000 = 1 ms, and therefore timer%7 will match 1 much more often.

    Just don't use timespans shorter than the framerate and use a range rather than a definite value (e.g. see it valid if timer%x is lower than 5 or something)

  • <img src="http://img18.imageshack.us/img18/5978/uawesome.jpg" border="0" />

  • So you learned it the hard way, may thank ROJO for recovering at least 192 images, and do backup your files from now on ;) (there even is an auto save and auto backup function in CC, just use them by enabling them in the preferences...)

  • I've corrected the issues and simplified the cap to better see it in action.

    I have to say, you ignored almost every explanation I gave in that post and in the screenshot of the events <img src="smileys/smiley4.gif" border="0" align="middle">

    Never omit brackets when copying events, they serve a purpose: The order of calculations is determined by brackets. Example:

    10 - 4 * 3 = -2

    (10 - 4) * 3 = 18

    I've put them back in.

    The second issue was the missing of an inherited layer with scrollrate and zoomrate set to 0, as mentioned.

    The third issue was a inaccuracy of myself. I didn't show, how the private variable 'pid' is exactly used for the aspect bars.

    In this cap the window is set to 1024x768, while the virtual screen stays at 1920x1080. Your layout size is 1920x1080, too, but you may set it to any size you like.

    F1 switches to fullscreen, F2 switches back to windowed. The fullscreen switch uses the current window size to determine the next best fullscreen size. So it will be 1024x768 fullscreen, presenting a virtual screen of 1920x1080.

    Be aware: This method uses zooming to achieve this. You can't use magicam if you want to use it in your game (magicam also accesses the global zoom, there is currently no relative zoom option in magicam)

    http://www.mediafire.com/file/kmro0jfuzdu3zvh/DynamicScaling.cap

  • Don't know if it is exactly what you mean, but I presented a method some time ago in the old forum that works with a virtual screen. This screen is set to some value (preferably 1920x1080 in your case) and it will always display that 1920x1080, no matter what resolution or ratio the user chooses. Black bars are used on non 16:9 ratios.

    last post in this thread, but the other posts might help as well

  • there's the absolute expression: abs()

    it returns a value without sign (that is: the positive representation)

    abs(-200) = 200

    abs(200) = 200

    ROJO was quicker^^

  • Then again, your original post had dividing the base damage by 4, but in that second post, you don't...ut yes, I did :)

    "Let's say, base attack is 40"

    "dmg = 10 * 1^1 + 10 * 0.5^1 + 10 * 2^1 + 10 * 0^1"

    Attack hit box:

    Base damage = 10

    Lightning = 1

    Fire = 0

    Earth = 0

    Water = 0

    Enemy defense:

    Lightning = 1

    Fire = 1

    Earth = 1

    Water = 1

    Now, I assume this would mean that the damage given to the enemy would be 10, but after trying it out, turned out to be 2.5. I... think I might've missed something. Did I? Or should it happen like that?It depends on how you put in the values to the formula. Remember, 0^1 equals 0, but 0^0 equals 1, so if you raise 'attack' to the power of 'defense', you get 1^1, 0^1, 0^1, 0^1

    That's three times 0, and one time 1. Every element influences 25% of the result, so the result is 2.5

    The one variable that is set to 0 if that element doesn't exist, should be the power. In that case you'd get

    1^1, 1^0, 1^0, 1^0

    That's four times 1, which would result to 10

  • Well, I did have exactly that in mind (the multiple elements influencing each other), but maybe I didn't understand the use of the two variables correctly?

    I thought one variable would have a value somewhere between 0 and 2 (the one I called 'lightning', 'fire', etc. And the second one would have a value of either 0 or 1 (according to your explanation: "If an attack didn't have one of the elements, that element would be set at 0."), the one I called "...existance"

    If both assumptions are given, then that formula works quite good. Let's just look at the four damage examples you made in the first post and pretend they are an "omni-elemental" attack. Let's say, base attack is 40. Then

    dmg = 10 * 1^1 + 10 * 0.5^1 + 10 * 2^1 + 10 * 0^1 = 10 + 5 + 20 + 0 = 35

    5 lower than the base attack, which makes absolutely sense, because while there is a double damage there is also a half damage, a normal damage and last but not least no damage.

    Each of the 4 elements will always influence the result by 25%. If there is only one element, you'd double only 25% of the result (which would lead to 50 in the example above, where base attack was 40). If that was not the intention, that formula won't work for you, of course.

    If you rather want something like "double the base damage, no matter what element is active", then I currently can't think of a reliable solution in only one formula, as you seem to aim for. (But maybe others can :) )

  • What I don't understand:

    I sent a game to a friend, a simple .exe with no instructions whatsoever. The next day I asked if there were any problems. Answer: "No, started the application, it wanted me to install something, I agreed, and the game runs nice."

    Could it be that often people just ignore the window that tells to install that needed files?

  • First problem:

    Instead of multiplying element by elementexistence, use e to the power of ee. If an element exists, ee equals 1, else it equals 0

    x^1 = x

    x^0 = 1

    (This works even if x = 0. 0^0 = 1, 0^1 = 0)

    So, if e is 2 and ee is 1, the result is

    2^1 = 2

    If it doesn't exist, it's

    2^0 = 1

    Second problem:

    Instead of multiplying all, split base damage into 4 parts (l = lightning, le = lightningexistance, f = fire, fe = fireexistance, etc.):

    dmg = (b / 4) * l^le + (b / 4) * f^fe + (b / 4) * e^ee + (b / 4) * w^we

    If an element doesn't exist, it will result to 1, so if no element exists, you'll get base damage as the result.

  • First part of your questions: No, C2 is still a bit behind CC.

    Second part: Not easy to answer. It depends on your goals. For example, if you want to create an executable, there is no other way than CC, but if you want to make a browser game, you need to use C2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That color suits you <img src="smileys/smiley4.gif" border="0" align="middle" />

    Congrats Kya <img src="smileys/smiley32.gif" border="0" align="middle" />