How to make gallery. Which will load images from files

  • 7 favourites

Stats

2,263 visits, 3,469 views

Translations

This tutorial hasn't been translated.

Create a translation

First of all we need appropriate background for our gallery.

But you can make any by yourself if you want. The next thing buttons.

for the right click and

for the left. That is all we need.

Open the new empty project, and put down all the needed images as sprites.On project settings set the "fullscreen in browser" to scale.

Next step: put any image that you want to the center. In the end the view mustbe:

Now the logic. Set global variable with initial value 0. It'll help us to change the images. Let's call it "index". Then set the mouse object. On left button clicked on object "leftclick" set System->add to->index.

The same thing to the right button but instead of "add to" use "subtract from"

Next, let our image load something from url. For this purpose put some images to the file directory and name them like this "0.jpg, 1.jpg, 2.jpg, 3.jpg", it is important. Then in event sheet do like this.

if you try to press the right click button it will change the image successfull.But we need to make "index" global variable change between 0 and 2. Do the actions above to limit our variable.

That is all the gallery will work well. I wanted to load the images from database, but hadn't got enough skills. If anyone knows how to do it please tell me how.