Can I designate a spot for an image to appear?

  • I would like to designate certain locations on a scrolling background to appear. The background will only scroll through once, so it will not be repeating. I have made images appear on a static background by using the choose() methods to make the image appear at particular x - y combination, like so:

    choose (100, 200, 300, 400)

    choose (150, 250)

    Using this method, the images appear at the particular spots I want, but the spots where the images can appear can only be in a grid format. I would like to have more variation in the image locations, and I want scrolling backgrounds as well.

    I have briefly looked at image points to designate these spots on a large background image that is several times the width of the viewport, and when that part of the background comes into view, then that spot may receive a new image (randomly selected). Do you think something like that would work, and is there a method to determine if an image point is within the viewport? Or perhaps a different method?

  • If the location is random I'm not sure why imagepoints would be useful? If you are saying they are not random but you are adding in lots of possible locations then I'm not sure creating a lot of imagepoints would be useful either. I don't see an issue with using the choose method that you already had?

  • You will have to do this mathematically.

    It should look something like this:

    Set X to: choose(100, 200, 300, 400) + background.X % 100

    Set Y to: choose(100, 200) + background.Y % 100

    You may have to experiment there a bit, unless that works perfectly in the first go.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • El Constructorr - thank you, I will play around with the calculation like you had mentioned. That should work if I must keep a grid-like layout.

    Plinkie - I mispoke a bit when I said "random". The backgrounds will be different, so different backgrounds will have different places where the images can appear. But, each background will have different locations, so using my choose() method will not always work, unless I adjust the choose() values for each background and keep the same grid-like structure. I was hoping for something a bit more fluid looking, and that is why I was looking at the image points.

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