Slide image from x, y -> x2, y2

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Question_dev
Posts: 88
Joined: Fri Aug 24, 2007 8:23 pm

Slide image from x, y -> x2, y2

Post by Question_dev »

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 !
Last edited by Question_dev on Thu Apr 03, 2008 8:02 am, edited 1 time in total.
hibbyware
Posts: 78
Joined: Wed Mar 28, 2007 10:29 am

Post by hibbyware »

You don't know how to do that?

If not then you are seriously in the wrong forum,
Question_dev
Posts: 88
Joined: Fri Aug 24, 2007 8:23 pm

Post by Question_dev »

Haha, 2nd april, funny. . . NOT

Sorry, but i'm a beginner. I've learned c a bit, and now i'm trying to code this, but can't figure it out. .

Tnx in advance
hibbyware
Posts: 78
Joined: Wed Mar 28, 2007 10:29 am

Post by hibbyware »

I think that's the point your missing this is not a beginners help forum,

These type of questions are just cluttering up the section and it makes it harder to find informaton,
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

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.....
Question_dev
Posts: 88
Joined: Fri Aug 24, 2007 8:23 pm

Post by Question_dev »

Just give me a tip so i can figure it out by myself.
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

You always need a tip
Image
Upgrade your PSP
jo3_sum
Posts: 17
Joined: Wed Jan 30, 2008 5:38 am
Contact:

Post by jo3_sum »

Question_dev wrote:Just give me a tip so i can figure it out by myself.
heres a tip:
know exactly what you want and you try figuring out how that will work.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

xi,yi = initial coords
xf, yf = final coords
x, y = current coords

Code: Select all

float speed = 0.01;
float k;
for &#40;k = 0; k<=1; k+=speed&#41;&#123;
  x = &#40;int&#41; &#40;xi*&#40;1-k&#41;+xf*&#40;k&#41;&#41;;
  y = &#40;int&#41; &#40;yi*&#40;1-k&#41;+yf*&#40;k&#41;&#41;;
// ...blit image at x,y...
&#125;
...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
Last edited by jean on Thu Apr 03, 2008 8:24 am, edited 1 time in total.
cruisx
Posts: 8
Joined: Tue Mar 25, 2008 8:26 am

Post by cruisx »

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
jsharrad
Posts: 100
Joined: Thu Oct 20, 2005 3:06 am

Post by jsharrad »

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.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

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.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

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"...
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Possibly. Won't know unless it gets tried. I'll leave the decision to the folks in charge. :)
User avatar
jbit
Site Admin
Posts: 293
Joined: Sat May 28, 2005 3:11 am
Location: København, Danmark
Contact:

Post by jbit »

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.....
This site isn't geared to beginners, there are many other places on the internet to learn basic programming.
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)
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

pseudo code

Code: Select all

steps = 10

dx = &#40;endx - startx&#41; / steps
dy = &#40;endy - starty&#41; / steps

x = startx
y = starty

for c = 0 to steps
  draw&#40;x,y&#41;
  x += dx
  y += dy
next
Jim
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

@jBit:
Don't tell me....i agree! I was only trying to figure it out HOW we can handle the tons of children only wanting to do something "cool" on their psp....
@jim:
UUUUUUUUUUUHHH... you optimized my code!!! Awesome!.....just kidding
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

:-P

Jim
Post Reply