Slide image from x, y -> x2, y2
-
- Posts: 88
- Joined: Fri Aug 24, 2007 8:23 pm
Slide image from x, y -> x2, y2
Hi,
I have searched everywhere, but cant find any thread about it.
How do i slide an image from 1 point (x, y) to another (x2, y2) ?
It has to be SLIDING.
I known how to blit images, etc.
Tnx in advance !
I have searched everywhere, but cant find any thread about it.
How do i slide an image from 1 point (x, y) to another (x2, y2) ?
It has to be SLIDING.
I known how to blit images, etc.
Tnx in advance !
Last edited by Question_dev on Thu Apr 03, 2008 8:02 am, edited 1 time in total.
-
- Posts: 88
- Joined: Fri Aug 24, 2007 8:23 pm
-
- Posts: 88
- Joined: Fri Aug 24, 2007 8:23 pm
xi,yi = initial coords
xf, yf = final coords
x, y = current coords
...not to say that to do a GOOD animation code, this is only a bare hint...
PS: in future, PLEASE refer to one of the billion tutorials about game programming around....if you cannot do it on a PC, this doesn't mean you can do it on a PSP
xf, yf = final coords
x, y = current coords
Code: Select all
float speed = 0.01;
float k;
for (k = 0; k<=1; k+=speed){
x = (int) (xi*(1-k)+xf*(k));
y = (int) (yi*(1-k)+yf*(k));
// ...blit image at x,y...
}
PS: in future, PLEASE refer to one of the billion tutorials about game programming around....if you cannot do it on a PC, this doesn't mean you can do it on a PSP
Last edited by jean on Thu Apr 03, 2008 8:24 am, edited 1 time in total.
jean wrote:Maybe noobs are fed of answers like "get lost!" and coders are sick of questions like "how can i compute the mean of three numbers?"
proposal: can't admins put a "PSP-Noob questions" area?? Maybe this way complex questions will not be lost in a sea of nonsenses.....
I second that =\ there should be a beginners section
http://www.google.com/search?hl=en&q=pr ... nner+forum
Lots of beginners "sections" already out there, I'm sure they're more than willing to help you with your simple questions.
I was under the impression this forum was for information specific to the PSP platform, whereas something like moving a sprite from point A to point B is more generic coding.
Lots of beginners "sections" already out there, I'm sure they're more than willing to help you with your simple questions.
I was under the impression this forum was for information specific to the PSP platform, whereas something like moving a sprite from point A to point B is more generic coding.
Well, if there were a beginner's forum, at least that should help cut down on threads to ignore. The problem would be that ignoring the beginner's forum would lead them to post in the regular forums anyway when they see the beginner's forum being ignored. So it may or may not help any.
Other than pissing off noobies, the current method of scorn and ridicule works pretty well, so any idea to replace it would have to do a better job of cutting down the number of noobie threads in the forums we care about.
Other than pissing off noobies, the current method of scorn and ridicule works pretty well, so any idea to replace it would have to do a better job of cutting down the number of noobie threads in the forums we care about.
J.F. wrote:The problem would be that ignoring the beginner's forum would lead them to post in the regular forums anyway when they see the beginner's forum being ignored.
I would not bet on it.... there's always someone who wants some free glory boasting of his superiority in middle of poors; aside from this, maybe a noob is better than another (even remaining a noob) and can answer while learning. If there's an arbitrary rule ("no noob questions in dev forum"), it will be more easy to say "wrong place" without the need to be unkind, and saying to change section in a forum sounds better than "change forum"...
This site isn't geared to beginners, there are many other places on the internet to learn basic programming.jean wrote:Maybe noobs are fed of answers like "get lost!" and coders are sick of questions like "how can i compute the mean of three numbers?"
proposal: can't admins put a "PSP-Noob questions" area?? Maybe this way complex questions will not be lost in a sea of nonsenses.....
ps2dev.org as a community is for PSP/PS2/PS3 development questions, not general development ones... As I've said before just because the code you're writing happens to be running on the PSP doesn't make it PSP code. Having said that advanced optimization techniques that aren't necessarily PSP related (and other such topics) are appropriate here.
The general ethos that used to exist in the ps2dev.org community before the PSP happened was that you should learn how to code relatively well before even stepping foot on a console, this seems to have been diluted now.
Also, holding hands isn't a good way to teach developers, it's more important for a developer to learn how to figure things out for themselves than to know how to move a sprite on screen. If they can't be bothered to do this, that's their problem.
(Yes this is a rant)
pseudo code
Jim
Code: Select all
steps = 10
dx = (endx - startx) / steps
dy = (endy - starty) / steps
x = startx
y = starty
for c = 0 to steps
draw(x,y)
x += dx
y += dy
next