NickRimer's Forum Posts

  • correct expression of random between two values - n and m (where m > n):

    a = random(m - n + 1) + n

    you may need floor(random()) if you want integer values

  • well, I missed that moment about overall damage..

    the problem is that you can't create object instance variables through runtime, just modify existing ones

    maybe you need to create a special array for this? store player's names (only those who deal a damage) and a damage they dealt (add with every hit).

    you can use array indexes according to monster UID, it will guarantee their uniqueness and creates a simple link between monter instance and array data.

    need an example?

  • floor(random(500)) will just return integer numbers from 0 to 499 (0, 1, 2, ..., 498, 499).. I can't understand what are you asking for, sorry..

  • ok, but be carefull!

    function Angle(x1,y1,x2,y2) returns from 0 to 180 and then from -179.99...99 to -0.00...01

    there is no from 0 to 360 degrees.

    you need to correct this moment if it's necessary

  • make this conversion by yourself.. it's not so important for math.

    if you need 270 degrees out where my program returns 0 just make a "270-degrees-offset"

    it's only important when you make an output for user

    maybe you need to make an blue sprite angle offset

    I can make one more example for you a bit later, I'm busy for now.

    Maybe you'll make it earlier by yourself

  • integer numbers are: 1, 50, 437, 189000 etc.

    float numbers are: 1.5, 0.125, 46.333 etc.

    see the difference?

    javascript by default makes float random - number from 0 to 1

    c2 improves it in this way: if you write for example random(47) it will return an integer part from 0 to 46 plus float part from 0 to 1 (as example, 35.005463528755)

    we need floor function to eliminate this float part (floor function rounds float number down, for example floor(55.001) = 55 and floor(55.999) = 55 too)

    so floor(random(47)) will return just integer numbers from 0 to 46 (0, 1, 2, 3, ..., 45, 46)

    of course, using floor function is optionally

    Does my explanation clear?

  • you can make your own icons and pictures and add them to your project

    delete old, paste new, just save their names and file types

    I recommend you an old but good in its simplicity program to work with icons - "@icon sushi"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • List down. At the bottom of any page you can find Download section.

    It has stable release (r195) and beta release (r198).

    Get the second, please.

  • random(950) means you'll have a number 0..949

    if your X coordinate will become from 0 to 45 (your square width/2) you'll see square partly off the screen. Right?

    I suppose that your square origin point is in its center.

    You must spawn X in range: from (square.width/2) to (screen.width - square.width/2)

    Use this:

    random(m - n + 1) + n,

    where m - higher bound, n - lower bound

    Let's take our example: m = 1280 - 45 = 1235, n = 90/2 = 45

    random(1235 - 45 + 1) + 45 = random(1191) + 45

    The lower bound is 0 + 45 = 45

    The higher bound is 1190 + 45 = 1235

    Make so on with Y coordinate.

    Also don't forget, if you want normal integer coordinates (not float) you must write your random this way:

    floor(random()). In this way full expression will be: floor(random(m - n + 1)) + n

  • In Project window you can find folder Files and subfolder Icons in it.

    It has 5 default icons with different dimensions and also a loading logo. Change it with your image.

  • What about my capx-source?

    You can drive green sprite with 8Direction behavior.

    When blue sprite will have LOS to green sprite you'll see Angle between them.

    Use this angle to locate, where is your enemy (in I, II, III or IV quadrant).

    Is it what you want?

  • Maybe it will be more efficiently to make it like this

    Monster has 2 instances:

    1) RecievedDmg = 0 (default)

    3) PlayersName = "" (default)

    Now let's simulate the situation:

    1. Player Deals damage DMG
    2. If (DMG > Monster.Received DMG) then
       2.1 Monster.ReceivedDmg = DMG
       2.2 Monster.PlayersName = Player.Name
    3. If (Monster.Health < 0) then
       3.1 Pick Player by comparison [Player.Name == Monster.PlayersName]
       3.2 Give loot to picked Player[/code:2yzyitwm]
    
    I hope you'll understand my vision of this.
  • Thanks for all your answers! This is my solution:

    1. It seems, there is no problem to execute game URL like this: .../index.html?lang=en

    2.

    System -> On start of layout
       Set value (VAR) to Browser.QueryParam("lang");[/code:126s9wj7]
    3. Result is VAR = "en"
    4. Now I can make all I want with VAR in my program!
  • [quote:1gr24oyz]If memory serves using random() will give you decimal values as well try int(random(10)).

    of course I forget about this float form of javascript random.

    but it will be more correct to use this function: floor(random(a))

    it really works as I said higher

  • Read this OFFICIAL page. I think that is all you want.

    https :// www - scirra - com/manual/111/button

    sorry, I can't make it with url tags, I have no enough reputation yet.

    you can also use CSS with some other controls, not only button, but they all are similar