How do I load a sprite based on mouse click

0 favourites
  • 6 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • I have two sets of hotspots (invisible sprites) on the screen. When the user clicks one of each I want to load a specific sprite based on a number (11.png, 21.png, 31.png, etc.). Can I do this?

    The only ways I see are 'load image from URL' which is not working due to security issues, and possible using animation frames, however the images are big.

    Ideally I'd just like to load an image from the local drive using a filename created on the fly with variables... 21.png, 31.png etc. If I could build the path to the sprite on the fly I could do this but I don't see how.

    Thanks for any suggestions.

    RonM

  • you could either do the animation frame load and then set the size of it or have the invisible sprites spawn the object directly or system-create an object at point x,y of the invisibles

  • ronm

    Can you add all these images to your project as files? You'll then be able to use "Load image from URL" action

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for these suggestions. I've tried 'load image from url' but have cross website issues... do you know if it's possible to use a relative path there and load the file from a local folder? Thanks..

  • dop2000 is talking about project files

    have a look here

    https://www.scirra.com/manual/141/files

    should be able to do what you want

  • Perfect, thank you! I would have missed that. Somethings are easy, others need a lot of looking in places I would not have hidden them. Appreciated.

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