180: 100 = 1 help pls

This forum is currently in read-only mode.
From the Asset Store
2D Pack of 180 pixel art vehicles to make top view game. ( Cars, trucks, motorbikes, trains, boats ).
  • Hi i need help with this

    i have for example: 180:100 and i need from this 1 (in pascal is it maybe DIV or MOD) or i have 179 : 10 i need 17. PLs help i do not know how to.

  • If you need the remainder of a division, then it is modulo. The sign used for modulo division is %

    180 % 100 = 80

    179 % 10 = 9

    But you seem to simply need the integer division, which rounds down to the next integer. That's int(somecalculation) or floor(somecalculation)

    int(180/100) = 1

    int(179/10) = 17

  • yea it is! :) ty but how i create from 180 alone digit 8 or 1 or 0? is this possible?

  • yea it is! :) ty but how i create from 180 alone digit 8 or 1 or 0? is this possible?Of course, it is :)

    Convert the number to a string, then loop through the length of the string and extract one letter each time.

    number to string conversion: string = str(number)

    getting the length of a string: length = len(string)

    get a substring at any position: substring = mid(string, start, length)

    looping: For (name, start, end), use 1 for start and len(string) for end

    within the loop use mid(string, loopindex, 1) to get one letter at that position

    To convert a string to a number, use int(string) again.

    Here is a very simple cap: numbertodigits.cap

    Have a look at the Construct wiki, explaining all of the expressions: System expressions

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thx Tulamide :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)