Moving a Sprite Across a Screen.
Author |
Message |
DanTheMan
|
Posted: Fri May 15, 2009 8:41 am Post subject: Moving a Sprite Across a Screen. |
|
|
What is it you are trying to achieve?
Moving a graphic shape across the screen, starting at the right edge and moving left.
What is the problem you are having?
I have absolutely no experience in moving sprites.
Describe what you have tried to solve this problem
I have tried to modify an example program from my teacher, but it wasn't working out.
Please specify what version of Turing you are using
4.1.1, like they're making any other version at the moment
--------------------------
Okay, I have used the template. Can anyone help me on this? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tallguy
|
Posted: Fri May 15, 2009 9:22 am Post subject: RE:Moving a Sprite Across a Screen. |
|
|
i had a few problems with this too, check this out
http://compsci.ca/v3/viewtopic.php?t=21002
those two guys really helped me out, they might help you out too :p |
|
|
|
|
|
DanTheMan
|
Posted: Fri May 15, 2009 11:35 am Post subject: RE:Moving a Sprite Across a Screen. |
|
|
Yeah, except this isn't exactly as complicated as what you were trying to accomplish. We are doing things in units, so once I get it to go right to left, we then have to make it bounce back and forth, and then make two of them bounce off each other, then make something happen when they collide.
It gets more and more complicated, but not really as complicated. I am in grade ten comp science. |
|
|
|
|
|
Tallguy
|
Posted: Fri May 15, 2009 11:45 am Post subject: RE:Moving a Sprite Across a Screen. |
|
|
do you want to move by themselves or have the user move them? |
|
|
|
|
|
DanTheMan
|
Posted: Fri May 15, 2009 11:46 am Post subject: RE:Moving a Sprite Across a Screen. |
|
|
I can make them moe using the keyboard, but I'm tryig to get it to move by itself. |
|
|
|
|
|
Tallguy
|
Posted: Fri May 15, 2009 12:00 pm Post subject: Re: Moving a Sprite Across a Screen. |
|
|
this is a really bad code for doing it, but its something like this
Turing: |
View.Set ("graphics:700;500, offscreenonly")
var x, x2, y, y2 : int
x := 10
x2 := 50
y := 690
y2 := 650
loop
x := x + 10
x2 := x2 + 10
drawfillbox (x - 10, 10, x2, 50, white)
drawfillbox (x, 10, x2, 50, black)
y := y - 10
y2 := y2 - 10
drawfillbox (y + 10, 10, y2, 50, white)
drawfillbox (y, 10, y2, 50, purple)
if y = x then
drawfilloval (maxx div 2, 10, 100, 100, yellow)
exit
end if
delay (50)
View.Update
end loop
|
this is just to get them to move, and that is a terrible way of doing collision detection, but then again i'm not doing your hwk for you |
|
|
|
|
|
tjmoore1993
|
Posted: Fri May 15, 2009 3:32 pm Post subject: RE:Moving a Sprite Across a Screen. |
|
|
Not that I encourage this but check out the submissions section and look for Ball Bounce it should help you
Don't steal the work though. |
|
|
|
|
|
DanTheMan
|
Posted: Tue May 19, 2009 8:12 am Post subject: RE:Moving a Sprite Across a Screen. |
|
|
Naw, I'm no plagirist. If I was to borrow that collision code, I would get permission and give proper creds
But I was thinking of borrowing that code, I found it intriguing.
Also Tallguy, I don't expect you to do my homework for me
Ps. Thanks for the code though! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
DanTheMan
|
Posted: Tue May 26, 2009 8:34 am Post subject: RE:Moving a Sprite Across a Screen. |
|
|
Sorry for the bump, but I need to use a sprite to move left to right. I was able to move a sprite using the arrow keys, but not on it's own. Any suggestions? |
|
|
|
|
|
Dusk Eagle
|
Posted: Tue May 26, 2009 2:58 pm Post subject: Re: Moving a Sprite Across a Screen. |
|
|
Can we see your code? |
|
|
|
|
|
|
|