Moving Sprite Demo

Posted May 19, 2006 at 12:21AM by QJ Staff Listed in: Homebrew Applications, Homebrew Demos Tags: yeldarb
Ó


PSPYeldarb has just provided some source code he has developed for the PSP. It's an arrow that one can move around the screen. This requires an external image, in this case 'arrow.png' and depends on the graphics.h header.


This program loads in a "sprite" (in this case it's just a simple arrow icon). I have made four frames of the sprite and put them all on the same image. The code splits these into separate "images" in an array. Basically, it's a way to get frames out of a single image (that way you don't have to mess with a ton of different image files).

The different frames in this case are different rotations of the arrow sprite. You can control the arrow with the arrow buttons. Turn the trail of arrows on and off with the triangle button. Left trigger slows down the speed, right trigger slows it up. "X" is the gas button.

Basically, by studying this source code (which, admittedly, is very simple) you will know how to make a sprite travel around the screen (bound by the edges), how to erase the image on subsequent frames, how to control speed, and how to pseudo-rotate a sprite.


Download: [Moving Sprite Source]



 
 
 

Comments

by - 2006-05-19 02:16:03
eboot.pbp?

how run i the "makefile"? with cmd.exe? sorry for my bad english.
by - 2006-05-19 02:21:22
Yeah. ..

I've always wanted to move an arrow around the PSP screen. With this little gem, I can. Can't wait to see it in action W@@T
by - 2006-05-19 03:05:58
How...?

How to run this on a PSP i dont get the whole thing and how to run. can somebody help me??!
by F34R - 2006-05-19 05:47:28
running the file

You have to compile the code before you can run it. If you don't know how to do that, then this isnt for you. Head over to the forums and check out the tutorials on how to set up an enviroment so you can compile the code.
by Spessi - 2006-05-19 08:06:27
Hmm....

It would be better if you could control it with the d-pad, then you can turn the arrow dynamicly... So this isn't a 'great' codesnippet, especially since it's basic c programming...
by - 2006-05-19 08:07:42
Great Stuff

Its about time someone made a thing like this, ive been waiting for sony to do for ages!! up yours sony the Homebrew scene roxxors more than u! Sprite: Its what the psp was made for.
by - 2006-05-19 14:01:25
Thanks

Nice job Yeldarb, this helps us newbie coders.
by - 2006-05-20 04:44:57
Prats

@2&6: it's a teaching tool for people who can be bothered to get off their fat asses and actually make something, unlike you
by - 2006-05-20 07:21:22
...

@8: Dweeb

Add New Comment




You must be logged in to post comments




Add QJ.NET
Add to My Yahoo!
Google Reader Subscribe with Bloglines
Add  to your Kinja digest Subscribe in NewsGator Online
Subscribe with Pluck RSS reader Add 'www.qj.net' to Newsburst from CNET News.com
Subscribe with SearchFox RSS del.icio.us www.qj.net
Add to Technorati Favorite! Add to My AOL
furl! it Stumble for Treehugger!