
-----------------------------------
CheshireFox
Mon Apr 14, 2014 9:39 pm

Rhythm Game
-----------------------------------
What is it you are trying to achieve?
want to have more then one sprite moving at once

What is the problem you are having?
cant get previous element of y to continue to decrease by 1 after new element of y is initiated 


Describe what you have tried to solve this problem



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




button := Pic.FileNew ("button.bmp")
var newWidth := Pic.Width (button)
var newHeight := Pic.Height (button)
var sButton := Pic.Scale (button, newWidth div 5, newHeight div 5)
buttonSprite := Sprite.New (sButton)
Sprite.SetHeight (buttonSprite, 1)
var num : int := 1
var x : int
var y : array 1 .. 299 of int
x := 100
Pic.Draw (background, 0, 0, picCopy)
for i : 1 .. 299
    y (num) := maxy
    num := num + 1
end for
num := 1
loop


    if Time.Elapsed = 999 or y (num) < maxy then
        Sprite.Show (buttonSprite)
        Sprite.Animate (buttonSprite, sButton, x, y (num), true)


        y (num) := y (num) - 1
        delay (1)
        num := num + 1
        if y (num) = -150 then
            Sprite.Hide (buttonSprite)


        end if
    end if

end loop




Please specify what version of Turing you are using
4.1.1

-----------------------------------
Insectoid
Tue Apr 15, 2014 6:34 am

RE:Rhythm Game
-----------------------------------
Using sprites makes just adds unnecessary complexity for a project like this. Just use traditional animation with Pic.Draw and cls. It might take a few hours to learn how to do it properly but it's ultimately a lot easier than using sprites, which are easier now but will be a pain in the ass later on.

-----------------------------------
Insectoid
Tue Apr 15, 2014 6:44 am

RE:Rhythm Game
-----------------------------------
As for your problem, look at this line:
[code]if Time.Elapsed = 999 or y (num) < maxy then [/code]

What are your y values initialized to? How likely is it that this line will execute at exactly 999ms after the program started?
