
-----------------------------------
shoobyman
Fri Dec 29, 2006 2:20 pm

warp speed thing
-----------------------------------
i was just experimenting with a star moving background thingy, and i created a warp effect also.

use arrow keys to move around, the farther you move from the srating point, the less stars though, so don't go too far.

if you press w you will go into warp speed, press e to exit warp speed.  I think it is pretty cool.


%BY SHOOBYMAN
View.Set ("offscreenonly")
colourback (black)
var starx, stary, starsize, starx2, stary2 : array 1 .. 2000 of real
var plx, ply : int
var direction : string := "up"
var movex, movey : real := 0
var chars : array char of boolean
var warp : boolean := false
plx := round (maxx / 2)
ply := round (maxy / 2)

proc MOVEALL
    for i : 1 .. 2000
        starx (i) += movex * starsize (i) * 2
        stary (i) += movey * starsize (i) * 2
        if warp = true then
            starx (i) += movex * starsize (i) * 18
            stary (i) += movey * starsize (i) * 18
            starx2 (i) += movex * starsize (i) * 19
            stary2 (i) += movey * starsize (i) * 19
        else
            starx2 (i) := starx (i)
            stary2 (i) := stary (i)
        end if
    end for
    movex := 0
    movey := 0
end MOVEALL

for i : 1 .. 2000
    starx (i) := Rand.Int (-1000, 1000)
    stary (i) := Rand.Int (-1000, 1000)
    starx2 (i) := starx (i)
    stary2 (i) := stary (i)
    starsize (i) := Rand.Real
end for

loop
    Input.KeyDown (chars)
    for i : 1 .. 2000
        if starsize (i) > 0.8 and warp = false then
            drawfilloval (round (starx (i)), round (stary (i)), 1, 1, 0)
        elsif warp = false then
            drawdot (round (starx (i)), round (stary (i)), 0)
        end if
        if warp = true and starsize (i) > 0.8 then
            Draw.ThickLine (round (starx (i)), round (stary (i)), round (starx2 (i)), round (stary2 (i)), 2, 0)
        elsif warp = true then
            drawline (round (starx (i)), round (stary (i)), round (starx2 (i)), round (stary2 (i)), 0)
        end if
    end for
    drawfilloval (plx, ply, 2, 2, 12)
    if warp = true then
        if direction = "up" then
            movey := -3
        end if
        if direction = "down" then
            movey := 3
        end if
        if direction = "left" then
            movex := 3
        end if
        if direction = "right" then
            movex := -3
        end if
    end if
    if warp = false then
        if chars (KEY_UP_ARROW) then
            movey := -3
            direction := "up"
        end if
        if chars (KEY_DOWN_ARROW) then
            movey := 3
            direction := "down"
        end if
        if chars (KEY_LEFT_ARROW) then
            movex := 3
            direction := "left"
        end if
        if chars (KEY_RIGHT_ARROW) then
            movex := -3
            direction := "right"
        end if
    end if
    if chars ('w') then
        warp := true
    end if
    if chars ('e') then
        warp := false
    end if
    MOVEALL
    View.Update
    delay (35)
    cls
end loop


-----------------------------------
frank26080115
Sat Dec 30, 2006 10:00 pm


-----------------------------------
riding that lil ship must hurt, nice work, hows the space shooter going?

-----------------------------------
ericfourfour
Sun Dec 31, 2006 12:20 am


-----------------------------------
You procedure called MOVEALL is all in capitals. This naming convention is usually reserved for constants. Instead try moveAll or move_all. For more information check out var star : array 1 .. 2000 of
    record
        x1. y1. x2. y2. size : real
    end record

-----------------------------------
Windsurfer
Wed Jan 10, 2007 4:34 pm

Re: warp speed thing
-----------------------------------
Uhm. you should be looping your stars so that after they go off the edge of th screen, they appear somewhere else... space is supposed to infinite, after all. :wink:

-----------------------------------
shoobyman
Wed Jan 10, 2007 6:54 pm

RE:warp speed thing
-----------------------------------
good idea, but for the game i will be making with this, you will not be allowed to go too far out because the mission is to defend a space station.  When the game is done i will post it up.  Should be pretty cool.

-----------------------------------
Barloq
Thu Jan 11, 2007 11:52 am

Re: warp speed thing
-----------------------------------
That's really cool man!

[schild=5 fontcolor=FF0000 shadowcolor=C0C0C0 shieldshadow=1]Just screwing around with the smilie creator![/schild]

-----------------------------------
Barloq
Thu Jan 11, 2007 12:03 pm

Re: warp speed thing
-----------------------------------
(Btw Shooby, the +2 on your karma was all me man. You're a cool poster.)
