this is probaly very easy to answer and very noobie, but how do you make stuff move(like an image)with C for the psp???
Printable View
this is probaly very easy to answer and very noobie, but how do you make stuff move(like an image)with C for the psp???
Change where you blit the image on the screen. Store these co-ordinates in variables, read the input of the controls and change the value of the co-ordinates accordingly. Then finally use these co-ordinates to blit the image on the screen.
ok thank you very much
EDIT::It moves, but it strecthes the picture, like i would need to remove the previous ones how do i do that?
how do i do that?
yes i know that would work, but couldn't that overload the psp's RAM after a while?
EDIT:: i actually tried that but it didn't work, how do you clear the screen?
stop making fun of me, is there a code that willl just clear the screen?
ok SOMEONE must know how to do this, i have seen plenty of homebrew where people ACTUALLY MOVE!(amazing isn't it?)so plz help me i want to start making psp games!
I did not intend to make fun of you.
I spent a good amount of time yesterday trying to think
of a way to guide you, without becoming your
personal debugging djinni.
I couldnt find a way, and to recognize and accept
this personal phail made me sad.
The best I can suggest now is that
you find , and study some existing source code
What dangee said to clear the screen is the concept method that most games do. How you actually clear the screen depends on the API, libraries, platform you are programming on.
No offense but do you really think you should be starting on C when you have no knowledge what so ever on the language. If you wish to start learning C I reckon you should get a book from your local library and study it
ok i was reading a C++ book because i wanted to learn about it, and i did those tutoials on psp-programming. I also know actionscript, so i am only half noob right now
i will clear up what exactly i am doing. I am using psp dev i have the libaries that the libinstaller for pspdev installed. i was following this tutorial
http://www.psp-programming.com/tutorials/c/lesson04.htm
i finished it and the tutorials following it, i have added some things to the code that will make it move, i try reblitting the images whenever i push one of the arrows, that works, but then the image that was there before it is still showing, i want to learn how to remove this or if i should do something else
i have atached the code files i thank if you deicde to take a look or help me.
Clarification: You are using the graphics and framebuffer code from PSP-programming tutorials.
Look at the header file of graphics.h. It shows all the functions you can use from the graphics.c source. Look for a function that clears the screen.
Also, those tutorials are in C, not C++.
ok i found one but im not sure how to use
extern void clearImage(Color color, Image* image);
i defined a color as "Black"(tell if thats not was i was supoosed to do)
I typed my code like this
clearImage(Black, Black, Image* ourImage);
here are the errors i get
main.c<63> : error: syntax error berfore 'Image'
SpooForBrains i knew that, but what is the difference
ok i tried dangees method again, and this time, IT WORKED!!!! thank you all very much for helping me solve my problem!!
The difference between C and C++ is as follows:
C++ has Object Oriented programming (such as Classes and polymophism)...in essence objects of things are defined and shaped...it more matches real-world representation and makes development more elegant and faster to create.
C is the predecessor older language which was strictly structured programming....which just means you did everything in functions with no true collectiveness grouping among them
C++ is a far more powerfull language
ok thank you for explaining that, But i have another question about coding, how do i detect hits? i am making a space invaders clone, i made the ship, got it to move and shoot, but now i need to learn to know when it hits stuff like an alien.
so good to hear you got stuff moving.
the common method of hit detection involves using the
screen position (x,y) , and
size (width,height) properties of your
sprite objects to find if any of them overlap.
(eg using the inequality operators )
how exactly would i type that?
EDIT::i tired it this way, i made it so that whenever the laser's x and y posistion are greater than or lesser than a certain number, it works, but if there is a better way to do this please tell me. Here is what it looks like
if(lx > 15 && lx < 45 && ly < 135 && ly > 105){
inv1stat = 0;
}
Just so.
At this stage in the programs dev. cycle, its useful to establish
all the main() flow control blocks and data objects, before
enhancements and optimisation.
You can add more tests inside the conditional statement body at any
stage.
eg. Test whether pixel coordinate
(lx-sprite.x,ly-sprite.y)
of the sprite image is see-thru.
now im having another problem, but this one might be a bit harder to answer.i have sucessfully gotten the ship to move and shoot, i have a row of 10 aliens which i can shoot and they will dissappear. My problem is getting them all to move correctly. i have tried different methods, but none of them work. I will keep looking for more ways myself, but if any of you know how to do this, all help will be greatly appreciated.
space invaders...
dont they kinda shuffle across till you
shoot the end one , then they all change direction...
.. or was that the Galaxians
thx, thats a good model to work from
but, you'll have to be a little less vague
about how your
Invader Attack Block (IAB) object
aint moving correctly
ok i decided to stop working on the space invaders(i got bored and i dont know how to do). Now this might sound surprising, but i have decided to work on an Ad-Hoc Messenger. I have found some code that will help me code the ad hoc functions.
http://forums.qj.net/f-guides-develo...ial-55788.html
im working on the menu and interface right now, now this is probably an easy question to answer. I working on a keyboard, and i need it to move one square when i push a button, i will explain here is the code i have now.
if(pad.Buttons & PSP_CTRL_RIGHT && selectorx < 210){
selectorx += 5;
}
this is what i want it to do, BUT i want it so that when i hold in the right button it still only move 5 pixels ONCE, instead of keep moving across the screen.
does anyone know how to do this??
please?
EDIT::Looked at some source code, fixed it
Ok im sorry im asking so many questions but now i have ANOTHER problem. How do i edit and add onto strings??
message += "a";
i try it like this, but it doesnt work, how would i code this correctly???
Use strncat
char *strncat(char * restrict s1,const char * restrict s2, size_t n);
The strncat function appends not more than n characters (a null character and characters that follow it are not appended) from the array pointed to by s2 to the end of the string pointed to by s1. The initial character of s2 overwrites the null character at the end of s1. A terminating null character is always appended to the result.Thus, the maximum number of characters that can end up in the array pointed to by s1 is strlen(s1)+n+1. If copying takes place between objects that overlap, the behavior is undefined.
try learning lua its alot easier
thank you very jamoot, it works, and ticth, i don't want to learn lua right now because im only 13 and might be a video game designer so it might help if i know the basics of C.
EDIT::How would I clear a string??
Please?????
It would help if you show us a little bit of code, so people can see exactly what it is your doing.
Ok, im trying to make an ad-hoc messenger, i just started coding for the psp so im not very good. For the ad-hoc stuff i will be using this tutorial.
forums.qj.net/archive/index.php/t-55788.html so you dont need to worry about that.
I wanted to do this because i have not found one of these and would like one(if there is one plz tell me) I am now working one the text editing stuff, right now only one letter works(but i know how to make them all work) and i need to now how to backspace or clear the text or something, ive included my source code, makefile, and images.
I think you should use your Space Invader Assault Ship
to shoot the letters ,
so they disappear..
Why?!?!?!?