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.
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
PSN ID: splodger15
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks