tag:blogger.com,1999:blog-31812157556595283122024-03-12T19:28:09.226-07:00My Games My CreationsThis is the showcase of games developed or being developed by me at home.
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-3181215755659528312.post-69434591239627906102019-04-21T03:10:00.001-07:002019-04-21T03:10:34.932-07:00Pygame: Resizing a window<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
<span style="color: #990000;"><b><span style="font-size: large;">Pygame: Resizing a window</span></b></span></div>
<br />
We already know how to create a game window using pygame. For creating a window, we use pygame.display. We set window size by setting the display mode in pygame. Now what if we want to make the window full screen? or we want to hide it, or resize it,<br />
There are some meethods in pygame.display module<br />
<br />
While setting the display mode, if we provide a third parameter,<b><span style="color: #741b47;"> pygame.FULLSCREEN</span></b>, we get a full screen window. For UNIX X11 driver there is one more function <b><span style="color: #741b47;"><code class="descclassname">pygame.display.</code><code class="descname">toggle_fullscreen</code><span class="sig-paren">(</span></span></b><span class="sig-paren"><b><span style="color: #741b47;">)</span></b> which works as switch between fullscreen mode and normal mode.</span><br />
<br />
<br />
<span class="sig-paren">if you want to hide the window leaving only icon behind to get the access next time to the running window, use <b><span style="color: #741b47;">pygame.display.iconify()</span></b> method.</span><br />
<br />
<span class="sig-paren">A working example of all these functions, is in the following gist.</span><br />
<br />
<br />
<br />
<span class="sig-paren"><script src="https://gist.github.com/josprachi/fd6962d8062c94d68b6490afedfbaf2b.js"></script></span></div>
You might get confused that above script just gives an empty window that can be resizable but it works just the same as window with contents check out following gist
<span class="sig-paren"><script src="https://gist.github.com/josprachi/d596c621ebc5133c691104944cbc24b4.js"></script></span>
</div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-53283604456609591332019-03-31T09:44:00.000-07:002019-03-31T11:11:30.743-07:00Pygame : Working with Sprites and animations<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
We already know<a href="https://crackpracgameshowcase.blogspot.com/2019/02/images-in-pygame.html" target="_blank"><span style="color: #741b47;"><b> how to load and display images in pygame</b></span></a> now. But those are only images.
You can do nothing more than displaying those images using a surface
object. For making games we need more than simply displaying. And
here comes the<a href="https://www.pygame.org/docs/ref/sprite.html" target="_blank"><span style="color: #741b47;"><b> Sprite module</b></span></a>.</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
By using this module
to its full potential, you can easily manage and draw your game
objects. The sprite classes are very optimized, so it's likely your
game will run faster with the sprite module than without.</div>
<div style="line-height: 100%; margin-bottom: 0in;">
This module not only
allow you to draw the images, but also do many operations on them
like animations, grouping etc.. Also it provides collision detection
power to your game development process. You need not write the whole
collision detection code by yourself.</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
The sprite module
provides two classes:</div>
<ol>
<li>
<div style="line-height: 100%; margin-bottom: 0in;">
Sprite</div>
</li>
<li>
<div style="line-height: 100%; margin-bottom: 0in;">
Group</div>
</li>
</ol>
<div style="line-height: 100%; margin-bottom: 0in;">
</div>
<div style="line-height: 100%; margin-bottom: 0in;">
The <span style="color: #741b47;"><b>Sprite</b></span> class is
designed to be a base class for all your game objects while the <span style="color: #741b47;"><b>Group</b></span>
class is container for the sprites. <span style="color: #741b47;">For example</span> if you are creating a
menu for your game, all the buttons in the menu are sprites. And the
menu itself is a sprite group.</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
In this post let’s
see an example of sprite class:</div>
<div style="line-height: 100%; margin-bottom: 0in;">
Let’s animate the
ship in our previous example with some water ripples around it. Like
in following video</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dykYPbqlhs4OlGe8NCFsx-KXlqy_ht8YLWzWENoUhHenKrEM0jRj2ci6fUFJ4TaJ8HxQqtTy55KO_cYHhTLow' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
In the above video
what we see our ship is not moving right now but having the water
around it is moving. To create this animation we’ll use the sprite
module of pygame. Till now our ship was only an image but now we’ll
turn it into a game object. To do so we’ll have to create a class
Ship extending <span style="color: #741b47;"><b>class pygame.sprite.Sprite</b></span> as follows:</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>class
Ship(pygame.sprite.Sprite):</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>def
__init__(self):</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>super(Ship,
self).__init__()</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
In sprite class we
need to assign the image of sprite as <span style="color: #741b47;"><b>“self.image =
image_to_assign” </b></span>
</div>
<div style="line-height: 100%; margin-bottom: 0in;">
now, we have to
display a ship, and a set of water ripple frames around it. That
means our main image is ship and we have to<b><span style="color: #741b47;"> blit</span></b> the water ripples
along with the ship.
</div>
<div style="line-height: 100%; margin-bottom: 0in;">
So we’ll assign<span style="color: #741b47;"><b>
self.image=ship</b></span> and create an array for animation frames as<span style="color: #741b47;"><b>
“self.animFrames”</b></span> and store the ripple images in this array. In
this way we have what we need to create our animation.</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
Now we have to
display this animation. Here, if we display all the ripple frames at
a time, we can’t call it animation; we want to animate it show
frame by frame. That means we’ll need a timer and an index to store
current frame. And also a position to display our sprite and its
animation. So let’s modify our sprite class:</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b><br /></b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>class
Ship(pygame.sprite.Sprite):</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> index = 0</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b><br /></b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> def
__init__(self, texture, animFrames, x=0, y=0, width=1, height=1):</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> super(Ship,
self).__init__()</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.image =
texture</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.animFrames = animFrames</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.currentFrame = self.animFrames[0]</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.x = x</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.y = y</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.rect =
self.image.get_rect()</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.width =
self.rect.width</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.height
= self.rect.height
</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
Here we are
providing texture of ship and animation frames as well as the rect
details to sprite from parameters.</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
To keep the
animation updating let’s write the update method:</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>def update(self):</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> if
self.isAnimating:</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.animate()</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
and to implement the
animation functionality, let’s add the following methods:</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>def
startAnimation(self):</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.isAnimating = True</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b><br /></b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>def
animate(self):</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.index
+= 1</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> if
self.index >= len(self.animFrames):</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.index = 0</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.currentFrame = self.animFrames[self.index]</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> time.sleep(0.01)</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b><br /></b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>def
stopAnimation(self):</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> self.isAnimating = False</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
Here the time.sleep
provides us the delay of displaying the next animation frame. Now we
have done everything our update method is properly updating the
sprite according to animation but to display the animation on the
screen, we’ll have to use the draw method of sprite class:</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>def draw(self,
surface):</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> surface.blit(self.currentFrame, (self.x-self.width,
self.y-self.height*0.2))</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> surface.blit(self.image, ((self.x), (self.y)))</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
Here we are drawing
the animation frame first and on top of the animation frame we are
drawing the ship. Because we want the water ripple under the ship.</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
Now we have
successfully created the Ship class we only have to instantiate it on
our previous window and run the code
</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
so as usual first
load images:</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
We already have
loaded the ship. We only need to load animation frames</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>shipAnimFrames_str =
["ripple0.png", "ripple1.png", "ripple2.png",
"ripple3.png", "ripple4.png"]</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b><br /></b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>shipAnimFrames = []</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>i = 0</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>while i <
len(shipAnimFrames_str):</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> shipAnimFrames.append((pygame.image.load(shipAnimFrames_str[i])))</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b> i += 1</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>ShipSprite =
Ship(ship, shipAnimFrames, winWidth*0.45, winHeight*0.75)</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>ShipSprite.startAnimation()</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
and inside the game
loop</div>
<div style="line-height: 100%; margin-bottom: 0in;">
call the update()
and draw() of ShipSprite
</div>
<div style="line-height: 100%; margin-bottom: 0in;">
as
</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>ShipSprite.update()</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<span style="color: #741b47;"><b>ShipSprite.draw()</b></span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
save the code and
run it to get output like above.</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
The complete code for the above is as follows:<br />
<br />
<script src="https://gist.github.com/josprachi/7e45e3c3ccfc5a3734e86e990d3ba656.js"></script>
<br />
<div style="line-height: 100%; margin-bottom: 0in;">
</div>
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
Similarly you can
use the background image also as sprite rather than a surface. By
making it sprite you can convert this whole code into an endless
travel for your ship as shown in following video.<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dziQuFq3wHah4Q1_AGjYVE7BvlesViahjDTbchsdspB4GN2c9MYCygwqqVFRd99tk1pTlOQOWd4cFZwuH3HiA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />
<div style="line-height: 100%; margin-bottom: 0in;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0in;">
You can get the
complete source code for this endless travel in the following <a href="https://github.com/josprachi/pyGamePractices/tree/master/endlessTravel" target="_blank"><b>repo</b></a>.
In the coming post let’s see what more we can do with sprites like
collision detection, grouping, other animations etc.. so stay tuned.</div>
<style type="text/css">p { margin-bottom: 0.1in; line-height: 120%; }</style></div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-19006667661124359892019-03-05T14:17:00.000-08:002019-03-22T04:46:36.613-07:00Pygame Images; a little More.....<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<span style="color: #990000;">A Little More About Pygame Images!</span></h2>
<br />
In <b><span style="font-size: large;"><a href="https://crackpracgameshowcase.blogspot.com/p/pygame-images.html" target="_blank">previous</a></span></b> post, we loaded and displayed images. Since we now know, how to load images, let's check out some more things that we can do with images...<br />
<br />
In first post, we set a text caption of the window now<span style="color: #990000;"><b><span style="font-size: large;"> let's set an icon </span></b></span>of the window.<br />
<br />
copy and paste these lines before the<span style="color: #741b47;"><b> <code>Game_Window= pygame.display.set_mode(winWidth,winHeight)</code>
</b></span><br />
<span style="color: #741b47;"><b><br /></b></span>
<span style="color: #741b47;"><b><code>
ship= pygame.image.load("ship.png")<br />
pygame.display.set_icon(ship)</code></b></span><br />
<code> </code>
<br />
Here point to remember is you need to set the icon before creating the Game_Window. A 32X32 icon is generally recommended.<br />
<br />
Our background is a river with banks,<span style="font-size: large;"><b><span style="color: #990000;"> lets add some bushes on both the sides of bank.</span></b></span> We first need to load the image of bush.<br />
<br />
<code>
<span style="color: #741b47;"><b>bush=pygame.transform.scale((pygame.image.load("bush.png")),(50,50))</b></span></code><br />
<br />
the bush image i'm having with me is little bigger so im going to scale it down to 50X50<br />
now let's create an array of bushes to show many bushes on the bank of river. Here we do not need to create so many images by loading images again and again. We have a method called as<span style="color: #741b47;"><b> <code>copy()</code></b></span> that will create copy of surface bush. so let's create 10 bushes here add the following lines below bush definition.<br />
<code>
<span style="color: #741b47;"><b>bushes=[]<br />
i=0<br />
while i < 10:</b></span></code></div>
</div>
</div>
<code><span style="color: #741b47;"><b> bushes.append(bush.copy())<br /> i+=1</b></span></code><br />
<code><span style="color: #741b47;"><b>
</b></span></code><span style="color: #741b47;"><b>
</b></span>now we have created 10 bushes we have to display those on the river bank.<br />
Let's reassign i to 0 and <br />
just below blitting the background, add the following lines<br />
<code>
<span style="color: #741b47;"><b>while i < len(bushes)</b></span></code><br />
<span style="color: #741b47;"><b><code> if i%2==0:<br /> Game_Window.blit(bushes[i],(winWidth*0.03,50*i))<br /> else:<br /> Game_Window.blit(bushes[i],(winWidth*0.83,50*i)) <br /> i+=1
</code>
</b></span> <br />
So now our window is going to look like <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht9ESpb2Y5lDCqZG0aoAkmpLGXpicaTY8FvwgJi4vCTp3FKNJrlm4z-p4ZEWjvFXiGu7mN-s_cxXVblQGwTL03i9STEv1fbmPTmels6UgFvqypG0Th7hznNA40gC6aUvdyYUG8VYOwc-Iv/s1600/riverbank.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="607" data-original-width="690" height="281" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht9ESpb2Y5lDCqZG0aoAkmpLGXpicaTY8FvwgJi4vCTp3FKNJrlm4z-p4ZEWjvFXiGu7mN-s_cxXVblQGwTL03i9STEv1fbmPTmels6UgFvqypG0Th7hznNA40gC6aUvdyYUG8VYOwc-Iv/s320/riverbank.png" width="320" /></a></div>
<br />
Now<b><span style="font-size: large;"><span style="color: #990000;"> Let's add a ship in our river. </span></span></b>As we already have loaded the image, we don't need to load it again.<br />
To display the ship on the window, we'll have to blit it on the window. Add the following line before <span style="color: #741b47;"><b><code>pygame.display.update().</code></b></span><br />
<code>
<span style="color: #741b47;"><b>Game_Window.blit(ship,(winWidth*0.45,winHeight*0.75))</b></span></code>
<br />
This will show the ship on the bottom of our window. We can also see the icon in the dock in the following image that is going to show the output of whatever we have done above.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI1qf_bTeqVPCeTbdWKrTFCqQFlZLuX79hhvN6dwq0L8yvHQ_Ocpe8SiKd4FRGIIwHJxMUreYnX1vwsJyr5VeQtMirduH1N3haC0i0ak3cl8KmLZe0M8LZ7xQCIfAbBZZKo_WnEYlrRMp1/s1600/imagetest03.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="649" data-original-width="816" height="254" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI1qf_bTeqVPCeTbdWKrTFCqQFlZLuX79hhvN6dwq0L8yvHQ_Ocpe8SiKd4FRGIIwHJxMUreYnX1vwsJyr5VeQtMirduH1N3haC0i0ak3cl8KmLZe0M8LZ7xQCIfAbBZZKo_WnEYlrRMp1/s320/imagetest03.png" width="320" /></a></div>
<br />
Now Let's see how to <span style="color: #990000;"><b><span style="font-size: large;">move this ship</span></b></span> forward till the other end of river...<br />
we only have to update the position of the ship. so before our game loop starts, define starting "y" Position of ship as<br />
<code>
<span style="color: #741b47;"><b>y=winHeight*0.75</b></span></code><br />
<code><span style="color: #741b47;"><b> </b></span><br />
</code>
update the y value as soon as you enter the game loop as follows:<br />
<code><span style="color: #741b47;"><b>
if y>0:<br />
y-=1</b></span></code><br />
And after you have blit background on the game window, now blit the ship as<br />
<code>
<span style="color: #741b47;"><b>Game_Window.blit(ship,(winWidth*0.45,y))</b></span></code><br />
<code><br />
</code>
<br />
At the end of game loop instead of <br />
<span style="color: #4c1130;"><b><code>pygame.display.update()</code></b></span>,call <code> <span style="color: #741b47;"><b>pygame.display.flip()</b></span></code><span style="color: #741b47;"><b> </b></span>to update the entire screen so you'll get the ship moving upwards.<br />
<br />
You can also play with transparency of images. All you need to do is set the alpha of the surface. The alpha values range from 0 to 255. 0 is a total transparent while 255 is completely opaque.<br />
<br />
Following is the complete code we worked till now. In this code we have a background, aset of some bushes, a moving ship an icon to window and a semitransparent image drawn on the background.<br />
<br />
The images required are in the same <a href="https://www.blogger.com/blogger.g?blogID=3181215755659528312" src="https://gist.github.com/josprachi/8dc0e253a2f49d61c15659430f7270a7">gist's attachments</a><br />
<br />
<script src="https://gist.github.com/josprachi/8dc0e253a2f49d61c15659430f7270a7.js"></script>
Now We can display images why not to use all those to create a simple game using these assets. In next post let's create some animations and have a look on events in pygame.
</div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-68098865534670644122019-02-27T11:30:00.000-08:002019-03-22T04:44:05.646-07:00Images in Pygame<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
<h2>
<span style="font-size: large;"><span style="color: #990000;">How to display Images in Pygame?</span></span></h2>
</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
In previous post, we created an empty window for our game. In this post, let's add some images to our window.<br />
In Pygame, Images are represented by a pygame object called as "<a href="https://www.pygame.org/docs/ref/surface.html">surface</a>". The Surface has a fixed
resolution and pixel format</div>
<div style="text-align: left;">
In<b><a href="https://crackpracgameshowcase.blogspot.com/2019/02/pygame-create-blank-window-for-your-game.html"> previous post</a></b>, when we wrote a code that gave us an empty window which was looking like this.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiul7_KTPpg1ocroxz1avqFpjSpiqkv5nnoJP0KiXLlom-MT7eUObRdRCI31KytEGMN5-0xNs63d1fNZKSmQ2obGanwfenna-nji3PAFCEdzlQLvhxpVOBQS5hVMPAAU328v-4AAXYiLoRB/s1600/pygame_emptyWindow03.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="403" data-original-width="440" height="292" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiul7_KTPpg1ocroxz1avqFpjSpiqkv5nnoJP0KiXLlom-MT7eUObRdRCI31KytEGMN5-0xNs63d1fNZKSmQ2obGanwfenna-nji3PAFCEdzlQLvhxpVOBQS5hVMPAAU328v-4AAXYiLoRB/s320/pygame_emptyWindow03.png" width="320" /></a></div>
<br />
Now we want to show some real picture on this window let's say something looking like this<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjkJqfJ5IrCHzzIBkeiPL71g1kDIGnawYHT4Aa4Y4Vsjy5alcwPRCKg72EU0MtSjZEPCYYy88DI0BK3GZ9Lb36gEVbTNN-grKHSiKG8FG5bcRE0k6DMsRSGNP-I3E_zH3pTqvbrNTPyX9n/s1600/gameBkg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="768" data-original-width="1024" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjkJqfJ5IrCHzzIBkeiPL71g1kDIGnawYHT4Aa4Y4Vsjy5alcwPRCKg72EU0MtSjZEPCYYy88DI0BK3GZ9Lb36gEVbTNN-grKHSiKG8FG5bcRE0k6DMsRSGNP-I3E_zH3pTqvbrNTPyX9n/s320/gameBkg.png" width="320" /></a></div>
<br />
for this we need to use two pygame modules those are <span style="background-color: white;"><b>pygame.surface</b></span> and<span style="background-color: white;"> <b> pygame.image</b></span><br />
<br />
there is a method called <b>pygame.image.load()</b> which is used to load images and <b>a blit()</b> function of surface object to show one image on top of another.<br />
<br />
please checkout following<a href="https://crackpracgameshowcase.blogspot.com/p/pygame-images.html" target="_blank"> <b>source code link</b></a> that will give you a step by step guide to get your window displayed as<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjagjyZJWBEHWHJyFhv63etXrAGuvuJqkr1L9nQfrDHCYruGhRVQXrTZdV2B1ByBd6L9Bmy8z_D9dAK25SUnCaKp6M5EtNOcfBe8RzFlLz2G8vnez-i_iF13-iRJoinscuCbQm0aKhYNQLo/s1600/ImageTest02.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="549" data-original-width="638" height="275" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjagjyZJWBEHWHJyFhv63etXrAGuvuJqkr1L9nQfrDHCYruGhRVQXrTZdV2B1ByBd6L9Bmy8z_D9dAK25SUnCaKp6M5EtNOcfBe8RzFlLz2G8vnez-i_iF13-iRJoinscuCbQm0aKhYNQLo/s320/ImageTest02.png" width="320" /></a></div>
<br />
<br />
and yeah,we got how to display images on our empty game window that we created in previous post .<br />
<a href="https://crackpracgameshowcase.blogspot.com/p/pygame-images.html" target="_blank"><b><span style="font-size: large;">Get the source code Here!</span></b></a> </div>
<br /></div>
</div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-9440407513143931002019-02-23T12:31:00.000-08:002019-03-22T04:45:40.687-07:00PyGame- Create a blank window for your game<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
<b><span style="color: #990000;"><span style="font-size: x-large;">How To Create an empty window for your game in Pygame</span></span></b></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
In last post we saw what is Pygame and how to install it. In this post let's start the first step for your game i.e. the display of your game. We are going to need a window in which you are going to place your other game objects. So let's get started....</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
To create our game window we are going to use pygame module named "display". This module creates a fully controlled display for our game.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Let's create a file named as GameScene.py and add the following code in it.</div>
<div style="text-align: left;">
<span style="background-color: white;"><br /></span></div>
<div style="text-align: left;">
<span style="background-color: white;"><b><code>import pygame </code></b></span><br />
<span style="background-color: white;"><b><code>from pygame.locals import *</code></b></span>
</div>
<br />
This'll import pygame in your file. Now for our window, we are going to need the dimensions i.e. width and height. so let's define them also a color. These lines will define these things<br />
<br />
<div style="text-align: center;">
<div style="text-align: left;">
<code>
<span style="background-color: white;"><b>winWidth=600</b></span></code></div>
<div style="text-align: left;">
<span style="background-color: white;"><b><code>winHeight=480</code></b></span></div>
<div style="text-align: left;">
<span style="background-color: white;"><b><code>color_CYAN=(0,255,255)</code></b></span></div>
<br /></div>
now we need to initialize the pygame and the display. The following lines will do it.<br />
<br />
<div style="text-align: left;">
<code>
<span style="background-color: white;"><b>pygame.init()</b></span></code></div>
<div style="text-align: left;">
<span style="background-color: white;"><b><code>
Game_Window=pygame.display.set_mode((winWidth,winHeight))</code></b></span></div>
<br />
Here we have created an object named as Game_Window, which is going to give us a rectangular surface with a width of 600 pixels and a height of 480 pixels.<br />
<br />
Let's save the file and run the code as follows:<br />
<br />
<div style="text-align: left;">
<code>
<span style="background-color: white;"><b>$python GameScene.py</b></span></code></div>
<br />
you'll see a blank window like this<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDdd7Kf_y-kozmipYBwr8Z3rhZG1D774QaiCmwEaPTWD8R7sAiuZ-qlOjDyAK_vNjpGUC6qEctFCMBye7JAJzf2yNEnU6ccP1xxkzmPDcouS9iifl4ck4WCoNuQCka3A1tUGvbZMYuReKb/s1600/Pygame_EmptyWindow_01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="407" data-original-width="428" height="304" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDdd7Kf_y-kozmipYBwr8Z3rhZG1D774QaiCmwEaPTWD8R7sAiuZ-qlOjDyAK_vNjpGUC6qEctFCMBye7JAJzf2yNEnU6ccP1xxkzmPDcouS9iifl4ck4WCoNuQCka3A1tUGvbZMYuReKb/s320/Pygame_EmptyWindow_01.png" width="320" /></a></div>
<br />
<br />
<br />
<br />
Right now you'll see this window just once and it'll get disappeared. To keep it displayed continuously, we'll need to update the display continuously. Add the following lines in your GameScene.py<br />
<br />
<code>
</code>
<br />
<div style="text-align: justify;">
<span style="background-color: white;"><b><code>while True:</code></b></span></div>
<span style="background-color: white;"><b><code>
</code></b></span>
<br />
<div style="text-align: justify;">
<span style="background-color: white;"><b><code> pygame.display.update()</code></b></span></div>
<span style="background-color: #d5a6bd;"><b><code>
</code></b></span>
<br />
<br />
These lines will keep the window steady on your screen but you'll see the "X" button to close window will not work right now. To make it work we'll have to detect event of closing the window.<br />
In your above while loop, add the following lines those are going to detect the events triggered on the display.<br />
<br />
<code>
<b><span style="background-color: #d5a6bd;"><span style="background-color: white;">for event in pygame.event.get():<br />
if event.type==QUIT:<br />
pygame.quit()<br />
exit()</span><br />
</span></b></code><b><span style="background-color: #d5a6bd;">
</span></b><br />
<br />
Here we are getting all the events triggered on our window and detecting the type of event. If we get a QUIT type of event, we are firing command <span style="background-color: white;"><b><code>pygame.quit()</code></b></span> that is going to quit the window.<br />
<br />
Now we have an empty window for our game. We can also change it's Title currently we see the title is "<b>pygame window</b>". Let's change it to "<b>Empty Game Window</b>"<br />
<br />
add the following two lines after <span style="background-color: white;"><b>pygame.init()</b></span><br />
<br />
<code>
<b><span style="background-color: #d5a6bd;"><span style="background-color: white;">caption="Empty Game Window"<br />
pygame.display.set_caption(caption)</span><br />
</span></b></code><b><span style="background-color: #d5a6bd;">
</span></b><br />
<br />
and you see title of the window changed<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisdxb6GaV4vUGts-Y4XLMTGTb4kNoEQlMx76pHA0S-I1n-yv8DPVYNe4ugURUEISLyi6uaDGcr5MuVMUocFjaHrti9iDsaBt6JkKviOaPBTzEqzOQ_AiUWHsi_ImB_SVcr6gYpyQYL_c3M/s1600/pygame_EmptyWindow02.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="415" data-original-width="476" height="278" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisdxb6GaV4vUGts-Y4XLMTGTb4kNoEQlMx76pHA0S-I1n-yv8DPVYNe4ugURUEISLyi6uaDGcr5MuVMUocFjaHrti9iDsaBt6JkKviOaPBTzEqzOQ_AiUWHsi_ImB_SVcr6gYpyQYL_c3M/s320/pygame_EmptyWindow02.png" width="320" /></a></div>
<br />
<br />
Now let's change the background color of the window.<br />
Add the following line after the Game_Window definition.<br />
<br />
<code>
<span style="background-color: white;"><b>Game_Window.fill(<code>color_CYAN</code>)</b></span></code><br />
<br />
And when we save and run this code, we'll see the output as:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvz5cMF9OrsVkUFXsPTTVpVwMy9zEO7mfln1spXpv5YXAZLrbGUOilG5uAv98Fcj4NWrkcbgBPPnbhrmb8rTLFGSt2HJsDVXjTVqojkQNS8ZlxWPoO5KcB-D7cHg9MmMQqrVRoPIM7OisE/s1600/pygame_emptyWindow03.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="403" data-original-width="440" height="292" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvz5cMF9OrsVkUFXsPTTVpVwMy9zEO7mfln1spXpv5YXAZLrbGUOilG5uAv98Fcj4NWrkcbgBPPnbhrmb8rTLFGSt2HJsDVXjTVqojkQNS8ZlxWPoO5KcB-D7cHg9MmMQqrVRoPIM7OisE/s320/pygame_emptyWindow03.png" width="320" /></a></div>
<br />
<br />
<br />
And that's it!! Now you are ready to write your game with a resolution of 600X480 window.<br />
<br />
The final code for the above window should look like:<br />
<br />
<br />
<script src="https://gist.github.com/josprachi/bc58114eebda6464635908806c2f8162.js"></script>
<br />
<div style="text-align: left;">
In <span style="font-size: large;"><b><a href="https://crackpracgameshowcase.blogspot.com/2019/02/images-in-pygame.html" target="_blank">next post</a></b></span> let's display some images on this empty window. </div>
<blockquote class="tr_bq">
<code><br /> </code></blockquote>
</div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-19398288909388849762019-02-20T22:40:00.000-08:002019-03-22T04:46:05.735-07:00Want to make games without installing heavy game engines? Try Pygame <div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: center;">
</h2>
<br />
<br />
<span style="color: #990000;"><b>What is Pygame?</b></span><br />
<br />
<br />
<span style="color: blue;"> <a href="https://www.pygame.org/" target="_blank">Pygame</a> </span>is one of the most popular 2d game engines. It is<span style="color: blue;"> <a href="http://www.libsdl.org/" target="_blank">SDL</a> </span>wrapper
for python. It is a powerful and very simple to use game engine. it is
specifically designed for game development so you get all the basic
elements of a game in it (eg.. sprites, timer, display functionality,
sound functionality, events etc..)<br />
Pygame is highly portable means you can use it with nearly with every platform.<br />
<br />
If
you want to teach kids programming, they find programming more
interesting when they make something like games. With pygame you can
write your full game code in a single file. You need not to create a big
and complicated file structure if you don't want to.<br />
<br />
<br />
<b><span style="color: #990000;">What you need to get started with Pygame?</span></b><br />
<br />
The thing that you need to get started with pygame is<b> python3 </b>installed
on your system. <b>Python 3.6.1</b> or greater is recommended by Pygame.<br />
<br />
<br />
<b><span style="color: #990000;">How to install?</span></b><br />
<br />
The best way to install pygame is with the <a href="https://pip.pypa.io/en/stable/" rel="nofollow">pip</a> tool (which is what python uses to install packages).<br />
when
you install python(newer versions), you get pip automatically
installed. We use the --user flag to tell it to install into the home
directory, rather than globally.<br />
<br />
You need <span style="color: #990000;"><b>latest pip</b></span> to install pygame. Try <span style="color: blue;"><a href="https://pip.pypa.io/en/stable/installing/#upgrading-pip" target="_blank">upgrading pip</a></span> if pygame starts compiling from source and and fails to install. <br />
<br />
Run the following commands to install pygame on your system:<br />
<br />
<span style="color: #990000;"><b>Windows</b>:-</span><br />
<br />
<code> <b><span style="color: #4c1130;">py -m pip install -U pygame --user</span></b></code><span style="color: #4c1130;">
</span><br />
<b><br /></b>
<span style="color: #990000;"><b>Linux</b>:-</span><br />
<br />
<code> <b><span style="color: #4c1130;">python3 -m pip install -U pygame --user</span></b>
</code>
<br />
<br />
You get Pygame already installed with <span style="color: #660000;"><b>Raspberry Pi</b></span>. You need not install it.<br />
<br />
If you want to install on <b><span style="color: #990000;">Mac or other platform</span></b>, go through the installation process<span style="color: blue;"> <a href="https://www.pygame.org/wiki/GettingStarted" target="_blank">Here</a></span><br />
<br />
<br />
Once you have installed Pygame, you are ready to GO......<br />
<br />
Stay tuned for posts related to how to use the various elements of Pygame <br />
<br />
In the<span style="background-color: white;"> <a href="https://crackpracgameshowcase.blogspot.com/2019/02/pygame-create-blank-window-for-your-game.html" target="_blank">Next</a> </span>post we'll see how to create an empty game window using Pygame...<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
</div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-33373202684466507822018-01-27T09:05:00.000-08:002018-01-27T09:05:16.455-08:00Game Physics: Introduction<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
<b><br /></b>
<br />
<h2>
<b><span style="color: purple; font-size: x-large;">What is game Physics?</span></b></h2>
<div>
<b><span style="font-size: large;"><br /></span></b></div>
<div style="text-align: left;">
<span style="font-size: large;"><span style="font-family: "times new roman" , serif;">Just
imagine you are playing Super Mario Bros, where he </span><span style="color: #cc0000; font-family: "times new roman" , serif;"><b>never
fells down</b></span><span style="font-family: "times new roman" , serif;"> on broken platform, or never collides with any
wall,enemy etc.... or imagine the same in Temple Run. Sounds
fun right but at the same time, you won't be able to
collect </span><span style="color: #cc0000; font-family: "times new roman" , serif;"><b>Coins</b></span><span style="color: #cc0000; font-family: "times new roman" , serif;">, </span><span style="color: #cc0000; font-family: "times new roman" , serif;"><b>foods</b></span><span style="color: #cc0000; font-family: "times new roman" , serif;">, </span><span style="color: #cc0000; font-family: "times new roman" , serif;"><b>Power
ups</b></span><b style="font-family: "times new roman", serif;">. Oh! That's gonna take all the fun of the
game.......</b></span><br />
<span style="font-size: large;"><b style="font-family: "times new roman", serif;"><br /></b></span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif; font-size: large;">So
here comes the physics. For most of the games, physics is the
most essential element of game. You can think of any game where there
is something falling, hitting, flowing, bouncing, etc… any action
which can be considered as action in physical world. For these kind
of actions to be implemented and to be shown realistic, game physics
is used.</span><br />
<span style="font-family: "times new roman" , serif; font-size: large;"><br /></span>
<span style="font-size: large;"><span style="color: #cc0000; font-family: "times new roman" , serif;"><b>Game
physics</b></span> means the introduction of the laws of physics
into a simulation or game engine, particularly in 3D computer
graphics (although there are many game engines developed for 2D
graphics as well), for the purpose of making the effects appear more
real to the observer. A physics engine is noting but approximate
simulation of real world physics actions in the game world and making
the components of a game behaving they are affected by physics. Here
the computations are done using discrete values.</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">Components of game physics include the <b>physics engine</b>, <b>program code </b>that is used to <b>simulate Newtonian physics</b> within the environment, and <b>collision detection</b>, used to solve the problem of determining when any two or more physical objects in the environment cross each other's path.</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">In coming few posts lets learn how to add physics into your game. Unity provides us a user interface to attach physics into the game.</span><br />
<span style="font-size: large;"><span style="color: blue;"><a href="https://crackpracgameshowcase.blogspot.in/2014/10/basic-shooting-game-created-in-unity3d.html" target="_blank">The basic shooting game</a> </span>I uploaded in previous posts is one of the easiest example of physics implementation in the game.</span><br />
<span style="font-size: large;">In coming posts we'll see how do we use physics engine in HTML5 games. this time we'll use Chipmunk physics engine with Cocos2d JS to make our game.</span><br />
<span style="font-size: large;">So stay tuned, we'll meet next week with one easy html5 game.</span></div>
<div style="line-height: 100%; margin-bottom: 0in;">
<div style="text-align: left;">
<br /></div>
</div>
</div>
</div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-42407864431875284732014-11-27T22:43:00.001-08:002014-11-27T22:43:28.624-08:00My First Android Game "Match The Mates"<div dir="ltr" style="text-align: left;" trbidi="on">
Hi,<br />
Check out my first android game made in Unity here is the link.<br />
<a href="https://play.google.com/store/apps/details?id=com.rhippostudio.matchthematesfree" target="_blank">https://play.google.com/store/apps/details?id=com.rhippostudio.matchthematesfree</a><br />
<br />
Reviews, Comments and suggestions are welcome.<br />
</div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-38568146066690871882014-10-12T23:29:00.002-07:002014-10-12T23:32:06.066-07:00Basic Shooting game created in Unity3d<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
CLICK ON THE IMAGE TO PLAY ONLINE</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
Shooting game created using all the basic game objects in Unity3d<span style="text-align: left;"> </span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://googledrive.com/host/0B71-A-82KoaXNi0wSkxDNHJTdnM/web_Build.html" target="_blank">
<img border="0" center="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSAgl0cA-BRbCP0qSMcMsInIGBkLZ8urDzXnmDmHQvq7ohNBqBAvdLxWckXeIfGA0lnJw_mitT9fNc0sdcDN9MR-eDda1tG12j7eF7F01lj0sIkpmmhLWET69LQr2yLiujMIBHIL0SzMi2/s1600/Shooter.png" height="474" href="https:/></a></div>
<br />
<div style=" text-align:="" />
</a>
<br>
<a href="https://googledrive.com/host/0B71-A-82KoaXNi0wSkxDNHJTdnM/web_Build.html" target="_blank">Shooting game created using all the basic game objects in Unity3d</a> </div>
</div>
<br><br> <div>Comments and suggestions are welcome</div>Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-47267913541255312602014-10-08T22:50:00.001-07:002014-10-08T22:50:19.002-07:00Tank created from basic game object in unity3D<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ-77cdp_uOma9HxFYmaIWcBueF7cGpUSYgYllRjvAM79PiYNgvL7N6jBfXV56v1ij8AISd7Jvo6uW5pFGZrNmG0xBf3ynAkZzfw-FCAqudAQF_YzrjBpo99uoQnavhMHT2ESDMYmizlyv/s1600/Tank.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ-77cdp_uOma9HxFYmaIWcBueF7cGpUSYgYllRjvAM79PiYNgvL7N6jBfXV56v1ij8AISd7Jvo6uW5pFGZrNmG0xBf3ynAkZzfw-FCAqudAQF_YzrjBpo99uoQnavhMHT2ESDMYmizlyv/s1600/Tank.png" height="285" width="400" /></a></div>
<br /></div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-3014706243786842632014-09-26T00:29:00.000-07:002014-09-26T00:29:27.213-07:00Short Video of Reflectorr<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<embed align="left" allowscriptaccess="always" height="700" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="https://dl.dropboxusercontent.com/u/66512584/Reflectorr/First_Video.swf" type="application/x-shockwave-flash" width="650"></embed>
</div>
<br /></div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-27806104445463330262014-08-18T12:16:00.000-07:002014-09-09T02:55:45.760-07:00Reflectorr- Prototype completed<div dir="ltr" style="text-align: left;" trbidi="on">
Finally I am done with the completion of the prototype of Reflectorr with some exciting difficulties and I am sharing a video reflectorr. any suggestions and comments are welcome... </div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-61863859930876246242014-07-11T11:31:00.001-07:002014-07-11T11:32:12.019-07:00How to create simple elevator in Unity3d<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<a href="http://crackpracgameshowcase.blogspot.in/p/creating-a.html" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwlrvLgKC_hQNU0xSLOqw1eijkhtA6BEqu6prOCxTxSE9qQoTvzdEmnbyt8oy7IzyaZ5OFrbICwHgMLGQdEnpakdLWFlwa6R22wrPvoeMTUEsTV1L5pCRmewm2u5v3On-4CzMeaxiBrb-n/s1600/building+elevator.png" height="342" width="640" /></a></div>
<br /></div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-27227361348186678982014-06-17T13:19:00.003-07:002014-06-17T13:20:53.809-07:00In the process of creating the HUD and updating the look of the puzzle board for Reflectorr<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
</div>
Since I was done with the basic level functionality, I wanted Reflectorr to get a better look and some sound effects too. Since I am using all the free and open source resources I could not find all the sound effects yet those I an going to need. So I firstly created new UI and new board too.<br />
<br />
I just have designed a new board with which I would be able to design more levels and those would not look messy but would make the player feel like "Oh its difficult but I love to play it". This is the board I designed in Gimp It may look very easy but took me a little time because I am still a newbie to Gimp.<br />
<br />
<b>So the following would be the base board for all the levels of Reflectorr:</b><br />
<b><br /></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJcwDQJOnB9_XY7qPXFWiggRYDUW1g-UHj4NeGuZXor7fJbh3OSyH14CCwAI0-hrqcToRInHhG7Gf5aHmhsqjwbVMKkAeQMzNbCAASIw2_jYZB6IlhbxWHlt7Ca7rR4pircB7VKYIC22Wp/s1600/Board.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJcwDQJOnB9_XY7qPXFWiggRYDUW1g-UHj4NeGuZXor7fJbh3OSyH14CCwAI0-hrqcToRInHhG7Gf5aHmhsqjwbVMKkAeQMzNbCAASIw2_jYZB6IlhbxWHlt7Ca7rR4pircB7VKYIC22Wp/s1600/Board.png" height="400" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>And the loading screen I designed for Reflectorr would be:</b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI_jRLlCeRYz6SWoAEV-6jASOvlDHHXd3xcNYtaz0ixWx2bTO1RVcuEOgnywpYEebuAjcz54Gd37ucyMNkMmZSQhNKPVECCSwwhndYefRu4ekOSWA9THuR-Kg0DnkGutpMhmwbURsKDotJ/s1600/Screen1TODisplay.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI_jRLlCeRYz6SWoAEV-6jASOvlDHHXd3xcNYtaz0ixWx2bTO1RVcuEOgnywpYEebuAjcz54Gd37ucyMNkMmZSQhNKPVECCSwwhndYefRu4ekOSWA9THuR-Kg0DnkGutpMhmwbURsKDotJ/s1600/Screen1TODisplay.png" height="425" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
As soon as I complete all the artwork I need, I'll post a video of Reflectorr with the basic functions are working. </div>
</div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-7682039478171786202014-06-01T09:43:00.002-07:002014-06-01T09:43:59.211-07:00Reflectorr <div dir="ltr" style="text-align: left;" trbidi="on">
Hi,<br />
Now I am done with 4 new levels in Reflectorr. Its still a little bit slow. I think I have to work much more with my main game manager script. Currently I am done with all the basic collision detection, Animations through animator and sprite editor. Previously I tried to use all the sprites individually to make animations using animator. But now new unity has the feature of sprite editor that makes me easy to slice the sprite sheet and get the required sprites. Right now I am using most of the art assets those are available as free open source game assets. But simultaneously I am working with "Gimp" to create them by myself.<br />
Here I am uploading some of the print screen images of Reflectorr's current status under development.<br />
<br />
Currently the following basic functions are working :<br />
<br />
<ul style="text-align: left;">
<li>Reversed directional input since we have to judge the position of player according to it's image "reflectorr".</li>
<li>As soon as the reflectorr collides with the campfire stones, the fire lights up and removes the shadow over that area. </li>
<li>As soon as all the shadows are gone, the Exit button is activated.</li>
<li>When player touches the Exit button, next level starts.</li>
</ul>
<div>
Here I am uploading some of the images of current status of Reflectorr:-</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>Level Loading Screen:-</b></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTC67HcipcVBwCnhCvDT-sCbU0tVZykj1SbPH6yxbVJGVGncmKdBeFTkg9ODKxD9Q8V2H1uX9wYHHhZ7pYCMFYLKRuQ7qJFDzCMqpo71vwsNwQtdbjYrvnqPhXPiJGvoqEMPNT4ZI08_5K/s1600/reflectorr+Onload+Level1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTC67HcipcVBwCnhCvDT-sCbU0tVZykj1SbPH6yxbVJGVGncmKdBeFTkg9ODKxD9Q8V2H1uX9wYHHhZ7pYCMFYLKRuQ7qJFDzCMqpo71vwsNwQtdbjYrvnqPhXPiJGvoqEMPNT4ZI08_5K/s1600/reflectorr+Onload+Level1.png" height="324" width="640" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>Player lights first camp fire:-</b></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC_ZPeZRBYdtWgWA2uBFU1pRneLlYETcIomohJDRwZJ5z37cbnkG18jDSMBsll9biYMso2rp4wwpYTIwMi56yZAcX352uxcDPbjwTA5HJGk0tbIpuOfibE1NI8RaFDmoyyHH1pcpI6H__X/s1600/reflectorr+collision+detection.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC_ZPeZRBYdtWgWA2uBFU1pRneLlYETcIomohJDRwZJ5z37cbnkG18jDSMBsll9biYMso2rp4wwpYTIwMi56yZAcX352uxcDPbjwTA5HJGk0tbIpuOfibE1NI8RaFDmoyyHH1pcpI6H__X/s1600/reflectorr+collision+detection.jpg" height="330" width="640" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>All the shadows are removed and Exit button is activated :-</b> </div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtTRu2le8qHQTVV3W23yAhMGi1sR7AwYkpvGiWXf0lGXgHFnQpWOx0w7ym40vu2kIrNMcmaCWxIJ9YJ5MpHnnf67ofpTkoeRkazVEPUWlK8gHGmXJGba4REEoAK5S7t2XdEO0pJAKvMcnu/s1600/reflectorr+level1+button+activated.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtTRu2le8qHQTVV3W23yAhMGi1sR7AwYkpvGiWXf0lGXgHFnQpWOx0w7ym40vu2kIrNMcmaCWxIJ9YJ5MpHnnf67ofpTkoeRkazVEPUWlK8gHGmXJGba4REEoAK5S7t2XdEO0pJAKvMcnu/s1600/reflectorr+level1+button+activated.jpg" height="332" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
By next week I want to add some special effects and sounds too.</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
</div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0tag:blogger.com,1999:blog-3181215755659528312.post-18418567747502194652014-05-25T06:22:00.001-07:002014-06-01T09:22:05.789-07:00Reflectorr<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<b>Under Construction:</b></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: purple;">Planning Phase</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<h4 style="clear: both; text-align: center;">
<span style="color: purple;"><b>Reflectorr</b></span> is reflection based <span style="text-align: left;">maze puzzle </span>game being developed as first game for my portfolio.</h4>
<div>
<div>
Reflectorr is a reflection based maze puzzle.</div>
<div>
The screen of Reflectorr is divided into two parts</div>
<div>
<ul style="text-align: left;">
<li>Actual maze and mirrored maze.</li>
</ul>
</div>
<div>
The left half part of board is the actual puzzle that a player has to solve which is covered with some shadow that prevents the player to view the puzzle.</div>
<div>
But we still have a mirrored map of the puzzle that is shown in right half part of the screen.</div>
<div>
There are some small stones shown inside the maze. Those are actually leftovers of some campfire but are still capable to burn those remove the shadow and player can see the maze covered below the shadow.</div>
<div>
The player has to walk through the maze in the puzzle according to the map.</div>
<div>
Since the map is mirrored image all the directions are reversed. </div>
<div>
Player has to reach the exit button in order to finish the level. </div>
<div>
But the exit button is active only when all the shadows are removed from the puzzle.</div>
<div>
<br /></div>
<div>
This game sounds a little confusing but when you start playing is really exciting or you can say<b> "Brain Twisting"</b> game</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvKdxN9Ji1g9V-3ZT4r4FwLae26YXdRmSyXh2mRtU-Q456_V0xi0Y4o96N0xU4bTVBx32OkmQNstX9A1q2yFiILQ0P6GFti_Ybq6ODSkHDSOcTtExRsy61m9PVI7tSsVTSHEOAs0-3t5GX/s1600/reflectorr+Onload+Level1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvKdxN9Ji1g9V-3ZT4r4FwLae26YXdRmSyXh2mRtU-Q456_V0xi0Y4o96N0xU4bTVBx32OkmQNstX9A1q2yFiILQ0P6GFti_Ybq6ODSkHDSOcTtExRsy61m9PVI7tSsVTSHEOAs0-3t5GX/s1600/reflectorr+Onload+Level1.png" height="324" width="640" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br /></div>
Prachi Joshihttp://www.blogger.com/profile/15166216236323373825noreply@blogger.com0