
-----------------------------------
Abbas_M
Sat Jan 16, 2010 3:03 pm

Collisions and Using Radiant with images
-----------------------------------
What is it you are trying to achieve?
Im trying to find out a way to make random zombies appear from an image i have and to have them colide with my spaceship thus ending the game


What is the problem you are having?
I do not know how to make random zombies appear and i do no know how to make them collide with my spaceship and end the game


Describe what you have tried to solve this problem
Reading tutorials but im far to much of a newbie to understand them properly


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




var font, picture1, ship, font2, font3, picture2, picture3, picture4 : int
var name : string
var x, y : int
y := 15
x := 15
var chars : array char of boolean



setscreen ("graphics:800;500")

process backmusic

    Music.PlayFileLoop ("Menu Music.mp3")

end backmusic

process ingamemusic

    Music.PlayFileLoop ("Ingame Music.mp3")

end ingamemusic


%Main Menu Screen
procedure mainmenu

    fork backmusic

    drawbox (0, 0, maxx, maxy, black)
    drawfillbox (0, 0, maxx, maxy, black)

    % Image of Menu
    picture1 := Pic.FileNew ("galaxy.jpg")
    Pic.Draw (picture1, 0, -50, picCopy)

    % Name of the game
    font := Font.New ("Terror Pro:32")
    Font.Draw ("Zombies in Space", 235, 450, font, red)
    Font.Free (font)

    % Controls of the Game
    font2 := Font.New ("Terror Pro:16:underline")
    Font.Draw ("Controls Of The Game", 35, 300, font2, red)
    Font.Draw ("Objective", 540, 300, font2, red)
    Font.Free (font2)

    % Control Scheme
    font3 := Font.New ("Terror Pro:12")
    Font.Draw ("Move Up : Up Arrow Key ", 35, 270, font3, red)
    Font.Draw ("Move Down : Down Arrow Key", 35, 245, font3, red)
    Font.Draw ("Avoid The Zombies to Score Points", 540, 275, font3, red)
    Font.Free (font3)

    % Images of Ingame Characters
    picture2 := Pic.FileNew ("z.gif")
    picture3 := Pic.FileNew ("ship.gif")
    Pic.Draw (picture2, 725, 7, picMerge)
    Pic.Draw (picture2, 686, 5, picMerge)
    Pic.Draw (picture3, 10, -10, picMerge)

    % User name
    locate (24, 36)
    colorback (black)
    color (red)
    put " Enter a name: " ..
    get name

end mainmenu

mainmenu

Music.PlayFileStop

setscreen ("graphics:800;500, offscreenonly")
ship := Pic.FileNew ("ship.gif")

picture4 := Pic.FileNew ("gal.jpg")

Music.PlayFileStop

% SpaceShip Movement Command
procedure movement

    fork ingamemusic

    loop

        Input.KeyDown (chars)

        %Main Movement Seqeunce
        if chars (KEY_UP_ARROW) then
            y := y + 5
        end if
        if chars (KEY_DOWN_ARROW) then
            y := y - 5
        end if

        Pic.Draw (picture4, 3, -50, picMerge)
        Pic.Draw (ship, x, y, picMerge)
        delay (2)

        View.UpdateArea (0, 0, maxx, maxy)
        Pic.Draw (ship, x, y, picMerge)
        cls

        %Boundrie to Up
        if y > 419 then
            y := y - 10
        end if

        %Boundrie to Down
        if y < -15 then
            y := y + 10
        end if

    end loop
end movement

movement



Please specify what version of Turing you are using
4.1.1

Ill appreciate all the help i can get
