Making images move across screen and reappear on other side?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
bicobalt
Posts: 8
Joined: Mon Jun 11, 2012 3:13 am

Making images move across screen and reappear on other side?

Post by bicobalt » Sat Jun 30, 2012 5:08 am

First of all, I need to know if by importing images into LiveCode they automatically become objects or if I need to make them that way.

The main thing I want to know how to do, though, and the subject of this post, is to have a background image move across the screen and reappear on the other side. It's for a game. I want to have one background image - a canvas-like one - move slowly across the screen and repeat after it has passed, and to have objects that are closer to the "camera" and are in the foreground (trees, rocks, animals, other plants, etc.) move across the screen more quickly.

You need take no mind of what the player is doing; let's just say that he or she is flying across the screen and passing all of the scenery by.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Making images move across screen and reappear on other s

Post by jmburnod » Sat Jun 30, 2012 9:07 am

Hi bicobalt,
I need to know if by importing images into LiveCode they automatically become objects or if I need to make them that way.
You can import a file in a control: Menu file -> import as control or use the "import" command by script
Have a look in the LC dictionary at:
•Import
Creates an image, EPS, audio clip, or video clip and copies the contents of a file into the object.
•filename
set the filename of image "myImage"
Specifies the file associated with a player or image.
•Text
set the text of image "MyImage" to the text of image "MyImage2"
Specifies the t
Best regards

Jean-Marc
https://alternatic.ch

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Making images move across screen and reappear on other s

Post by sturgis » Sat Jun 30, 2012 2:37 pm

https://dl.dropbox.com/u/11957935/scrol ... e.livecode Here is a sample stack that might get you started. The stack script was part of the game academy, and I would highly recommend getting the academy dvd so you can go through the game academy stuff.

The stack uses the gameloop from game academy to move things across the screen. This was just a quicky version but it should give an idea. (I use a timing method to use the pieces but just changeing the move increment would work too)

If you want to get the game academy, plus 2 more academies you can find the dvd here. http://www.runrev.com/store/product/liv ... ademy-dvd/ It says business academy but includes the game academy and summer academy also.

Post Reply