-
Home
- Xna game studio
- Xna game studio
- Xna0130-collision detection
Learn how to design and create a Sprite class that provides collision detection. Also learn how to write an XNA program that takes advantage of that collision detection capability.
Revised: Mon May 09 18:37:13 CDT 2016
This page is part of a Book titled
XNA Game Studio .
Table of Contents
Preface
This module is one in a collection of modules designed primarily for
teaching
GAME 1343 Game and Simulation Programming I at
Austin Community College in Austin, TX. These modules are intended tosupplement and not to replace the textbook.
An earlier module titled
Getting Started provided information on how
to get started programming with Microsoft's XNA Game Studio.
Viewing tip
I recommend that you open another copy of this module in a separate
browser window and use the following links to easily find and view the Figuresand Listings while you are reading about them.
-
Figure 1 . Screen output at three different times while the program was running.
Listings
-
Listing 1 . A new Image property accessor method in the Sprite class.
-
Listing 2 . A modified constructor.
-
Listing 3 . A modified SetImage method.
-
Listing 4 . A new method named GetRectangle.
-
Listing 5 . Beginning of a new IsCollision method.
-
Listing 6 . Test for a collision with other sprites.
-
Listing 7 . Beginning of the overridden LoadContent method of the Game1 class.
-
Listing 8 . Instantiate the spider and ladybug Sprite objects.
-
Listing 9 . Beginning of the overridden Update method.
-
Listing 10 . Beginning of a for loop that controls the collision testing.
-
Listing 11 . Test for a collision.
-
Listing 12 . Spiders don't die easily.
-
Listing 13 . The overridden Game.Draw method.
-
Listing 14 . The Sprite class for the project named XNA0130Proj.
-
Listing 15 . The Game1 class for the project named XNA0130Proj.
Questions & Answers
how does the planets on our solar system orbit
how many Messier objects are there in space
Astronomy (from Ancient Greek ἀστρονομία (astronomía) 'science that studies the laws of the stars') is a natural science that studies celestial objects and phenomena. It uses mathematics, physics, and chemistry in order to explain their origin and evolution.
Rafael
what is big bang theory?
Rosemary
what type of activity astronomer do?
Rosemary
the big bang theory is a theory which states that all matter was compressed together in one place the matter got so unstable it exploded releasing All its contents in the form of hydrogen
Roaul
I want to be an astronomer. That's my dream
Astrit
Who named the the whole galaxy?
what is the dark matter
Richard
what are the factors upon which the atmosphere is stratified
bigbang is the beginning of the universe
Sokak
but thats just a theory
Sokak
nothing will happen, don't worry brother.
Vansh
these are Rocky substances between mars and jupiter
GANGAIN
Comets are cosmic snowballs of frozen gases , rock and dust that orbit the sun. They are mostly found between the orbits of Venus and Mercury.
Aarya
hey can anyone guide me abt international astronomy olympiad
sahil
how can we learn right and true ?
why the moon is always appear in an elliptical shape
Because when astroid hit the Earth then a piece of elliptical shape of the earth was separated which is now called moon.
Hemen
Did you mean eye sight or sea level
Minal
oh sorry it's sea level
lidiya
according to the theory of astronomers why the moon is always appear in an elliptical orbit?
Gatjuol
hi !!! I am new in astronomy....
I have so many questions in mind ....
all of scientists of the word they just give opinion only.
but they never think true or false ...
i respect all of them...
I believes whole universe depending
on true ...থিউরি
Govinda
we're all stars and galaxies a part of sun. how can science prove thx with respect old ancient times picture or books..or anything with respect to present time .but we r a part of that universe
w astronomy and cosmology!
Michele
another theory of universe except big ban
there many theory to born universe but what is the reality of big bang theory to born universe
Asmit
what is the exact value of π?
Nagalakshmi
there are many theories regarding this it's on you believe any theory that you think is true ex. eternal inflation theory, oscillation model theory, multiple universe theory the big bang theory etc.
Aarya
I think after Big Bang!
Michele
from where on earth could u observe all the stars during the during the course of an year
I think it couldn't possible on earth
Nagalakshmi
in this time i don't Know
Michele
is that so. the question was in the end of this chapter
Karuna
in theory, you could see them all from the equator (though over the course of a year, not at pne time). stars are measured in "declination", which is how far N or S of the equator (90* to -90*). Polaris is the North star, and is ALMOST 90* (+89*).
So it would just barely creep over the horizon.
Christopher
Got questions? Join the online conversation and get instant answers!
Source:
OpenStax, Xna game studio. OpenStax CNX. Feb 28, 2014 Download for free at https://legacy.cnx.org/content/col11634/1.6
Google Play and the Google Play logo are trademarks of Google Inc.