Restored from previous forum. Originally posted by Kerfew.
The reason why I copied the sprite (and only because I know no better) is that if I want one sprite to do something to interact with another sprite, I assumed that a sprite with the same number would then be read by all, and not just the one that is interacting. if that even makes a ounce of sense.
I tried that line of code TheBeck, but it says it's not a function.
This is my code in full.
; Make sure the thing will work
If InitKeyboard() = 0 Or InitSprite() = 0
MessageRequester("Error", "Can't open DirectX 7", 0)
End
EndIf
OpenScreen(800, 600, 32, "tester")
; Set basic variables
rabbitx=100
rabbity=375
; Draw a box on screen, then turn it into a sprite, then delete drawn box
StartDrawing(ScreenOutput())
tone=RGB(100,0,100)
Box(10, 10, 10, 3, tone)
Box(0, 0, 10, 10, tone)
StopDrawing()
GrabSprite(0, 0, 0, 10, 10, 0)
ClearScreen(0,0,0)
For c=1 To 2
CopySprite(0, c)
Next
; animate and move sprite
Repeat
FlipBuffers()
ClearScreen(0,0,0)
ExamineKeyboard()
For c=0 To 2
DisplaySprite(c, rabbitx+(c), rabbity)
Next
; this is just a simple line to see if I can get one of the boxes to do its own thing
rabbitx2=rabbitx2+1
If (KeyboardPushed(#PB_Key_Right))
rabbitx=rabbitx+5
EndIf
If (KeyboardPushed(#PB_Key_Left))
rabbitx=rabbitx-5
EndIf
If (KeyboardPushed(#PB_Key_Up))
rabbity=rabbity-5
EndIf
If (KeyboardPushed(#PB_Key_Down))
rabbity=rabbity+5
EndIf
Until KeyboardPushed(#PB_Key_Escape)
End
As you can see there is a line that reads rabbitx2=rabbitx2+1. What I'm trying to achieve is just to see if I can get one sprite to move off by itself without being controlled by the arrow keys.
I've done this in AMOS over a decade ago, and more receintly in FLASH, but I don't know the structure of how to do things in Pure Basic, and I'm not following the online help.
I'd probably be alright if I knew the syntax of Pure Basic. For example in structures, I don't really understand how to call it and retrieve data. And I see things like y.x which means nothing to me.
Hope someone smart out there can help me.
Kefrew
confused - dazed - but not dead