i need help moving it
Author |
Message |
computer_killer
|
Posted: Thu Dec 16, 2004 12:08 pm Post subject: i need help moving it |
|
|
what is the code for moving an object? im doing frogger for a class project. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Delos
|
Posted: Thu Dec 16, 2004 1:46 pm Post subject: (No subject) |
|
|
None exists.
If you want to move an object/picture on the other hand, there are numerous ways of doing it, the most common being that one uses variable x-coord and y-coord values, and in some sort of loop systematically change them.
Post your code:
- we'll get a better idea of where you are
- you'll more precise help |
|
|
|
|
|
Tony
|
Posted: Thu Dec 16, 2004 5:07 pm Post subject: Re: i need help moving it |
|
|
computer_killer wrote: what is the code for moving an object?
code: |
Object.move(newLocation)
|
now that's assuming that your object has a working move method. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Cervantes
|
Posted: Thu Dec 16, 2004 5:18 pm Post subject: (No subject) |
|
|
Tony: And that the object moves in a one dimensional plane
You probably won't have an object, per se, as you're working in Turing. You will probably have a bunch of variables that you clump together to store information about your "object".
When you draw your object on the screen, you'll be using (most likely, as Delos pointed out) two variables, x and y. That is, your Draw command will use these two variables. Thus, changing these variables will change the location of the "object", making it "move".
If you want to be able to move the "object" in one line, you'll have to make a procedure (like what Tony was getting at):
code: |
procedure MoveObject (newX, newY : int)
objectX := newX
objectY := newY
end MoveObject
MoveObject (100, 148)
|
|
|
|
|
|
|
Tony
|
|
|
|
|
Cervantes
|
Posted: Thu Dec 16, 2004 5:47 pm Post subject: (No subject) |
|
|
Somehow, when I posted that comment, I knew you were going to comeback with some computer kung-fu science and prove me wrong.
Bah!
I think we should be keeping things simpler than that, in this thread. |
|
|
|
|
|
Tony
|
|
|
|
|
|
|