Computer Science Canada

HElp with image transfer

Author:  enimirahi [ Sun Apr 19, 2009 6:22 pm ]
Post subject:  HElp with image transfer

HEy, sorry this is probably my last question ok so this code here that i created makes images of stars move accross the screen. NOw my assignment is to
Import an image file (.jpeg or .png) and with that image make that one move. but i made a star able to move but how do i get a random image from the internet in that code to work and move. If its ok can u take my code and add anyrandom image to it so i can see what needs to be done because i dont seem to understand how to put the image in the code thats my wholde problem

Turing:
const STAR_SIZE : int := 80
var pic, x, y, dx, dy : int

% Get the original picture
Draw.FillStar (3, 3, STAR_SIZE - 3, STAR_SIZE - 3, brightred)
pic := Pic.New (0, 0, STAR_SIZE, STAR_SIZE)
cls

% Set the initial location and direction of movement
x := Rand.Int (0, maxx - STAR_SIZE)
y := Rand.Int (0, maxy - STAR_SIZE)
dx := 2
dy := 2



loop
    if x + dx < -3 or x + dx > maxx - STAR_SIZE + 3 then
        dx := -dx

    end if
    if y + dy < -3 or y + dy > maxy - STAR_SIZE + 3 then
        dy := -dy
 
    end if
    x += dx
    y += dy
    Pic.Draw (pic, x, y, picCopy)
    exit when hasch

end loop


Mod Edit: Remember to USE SYNTAX TAGS!
code:
[syntax="turing"]Code Here[/syntax]

Author:  BigBear [ Sun Apr 19, 2009 7:40 pm ]
Post subject:  RE:HElp with image transfer

instead of Pic.New which takes a portion of the screen and treats it like a picture use

Pic.FileNew

and then you specify the name and to keep it simple make sure they are saved in the same folder


: