How do I use touch input for scaling

0 favourites
From the Asset Store
Surena Touch
$1.25 USD
50% off
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • I'm not sure what's going on in your code.

    If you want to change font size with the sprite size, the easiest solution is to add them to a hierarchy. You can do this temporarily, and remove text from hierarchy after resizing.

    Another option is something like this:

    Text set font size to 18*(Spaceship.width/Spaceship.imageWidth)

  • Hi dop2000

    If you want to change font size with the sprite size

    No, based on your pervious suggestion, I already did it, here the c3p. It working as expected. However my question is, it would be simpler if it could be achieved directly using the text without the need for a sprite, So for that I believe I'm almost there; just a few expert modifications are needed to make it work.

    I'm not sure what's going on in your code.

    I've been attempting it through make it work based on The C3P file you provided earlier (which works great) However, it won't work for this text object, obviously because there's no scale option for text objects. So, I'm using font size instead. If you click the resize button for the text, it's working to some extent, meaning it's changing the text size based on touch input, but not correctly. (The issue is Similar to what you solved previously the only difference is, it is text instead of sprite).

    Please check this c3p where I modifyide your previous code to work with text instead of sprite using font size.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Like I said, I can't make sense of your code. Here is my attempt, it's not pretty, but perhaps you will find it useful:

    dropbox.com/scl/fi/u6l027n6mai1oqvikgow9/TextResizing.c3p

  • Hi dop2000, Thanks for the C3P file. It is definitely useful, but I believe I somehow failed to make you understand what I wanted to achieve with that C3P, now I've made some further changes to the C3P file to enhance its readability, I hope it will make sense now.

    It is now identical to the code you provided earlier, with just a few edits here and there on variables or some other parts to make it compatible for text. Additionally, I added a bit of code:

    System: Every tick
    -> Set size of TextMain to (TextMain.TextWidth, TextMain.TextHeight)
    

    This ensures that the text size is adjusted dynamically based on its text content.

    Please take a look at the updated C3P file here.

    I believe I'm now even closer to achieving the desired result, with just a few expert modifications needed.

  • Nah, maybe someone else will be able to help. I've given two solutions already.

  • Maybe I confused myself by thinking that the same logic could work here. Nonetheless, thank you for your time and input. I've learned so many concepts of C3 through this interaction. Thank you.

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