Author |
Message |
Tallguy
![](http://compsci.ca/v3/uploads/user_avatars/515706924539b443d32a6e.gif)
|
Posted: Mon Jun 02, 2008 1:04 pm Post subject: Sniper Game |
|
|
I'm planning of making a sniper game. This is my problem , i want it so you just see through the scoop and nothing else. But i want objects to be seen once you scoop over them. If anyone knows wat i'm talking about, can u plz help? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Vermette
![](http://compsci.ca/v3/uploads/user_avatars/637825944810b5d4444c6.jpg)
|
Posted: Mon Jun 02, 2008 1:38 pm Post subject: RE:Sniper Game |
|
|
It's been years since I've programmed in Turing, but the concept you want (only showing things that appear behind or under a certain polygon shape) is called masking. Without knowing myself if there's anything in the Turing API to do this, consider this simple psuedocode solution to produce a square scope of 50 pixels centered on the mouse pointer:
//draw scene objects
//to cover up scene around scope
get x,y position of mouse (call them Mx, My)
drawfillrectangle(0,0 to Mx-25, maxY) //fill to left of scope
drawfillrectangle(0,0 to maxX, My-25) //fill above scope
drawfillrectangle(Mx+25,0 to maxX, maxY) //fill to right of scope
drawfillrectangle(0,My+25 to maxY, maxY) //fill under scope
this way you draw everything, then your mask (those 4 rectangles) draw over everything except where you want your viewscope to be.
Hope this points you in the right direction. |
|
|
|
|
![](images/spacer.gif) |
SNIPERDUDE
![](http://compsci.ca/v3/uploads/user_avatars/16932914504cbd0ad6ceaf1.jpg)
|
Posted: Mon Jun 02, 2008 2:57 pm Post subject: Re: Sniper Game |
|
|
Vermette has the exact concept.
I have done it in turing before here, if only I remember how... |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Mon Jun 02, 2008 4:27 pm Post subject: RE:Sniper Game |
|
|
I suppose you could use a giant sprite that's all black except where you draw the scope, in white. Set white as the invisable color and presto! as long as it's big enough to cover the entire screen. You don't need to re-draw anything! |
|
|
|
|
![](images/spacer.gif) |
Tallguy
![](http://compsci.ca/v3/uploads/user_avatars/515706924539b443d32a6e.gif)
|
Posted: Tue Jun 03, 2008 11:10 am Post subject: RE:Sniper Game |
|
|
does anyone have an example that i could look at? |
|
|
|
|
![](images/spacer.gif) |
andrew.
|
Posted: Tue Jun 03, 2008 9:23 pm Post subject: RE:Sniper Game |
|
|
Why do you need an example. What he means is, make an image (in Paint or something) that is what you see on the screen. Then load the image in Turing and have it always draw around where the mouse is. That way there's no messy code or drawing anything, just load an image over everything. |
|
|
|
|
![](images/spacer.gif) |
SNIPERDUDE
![](http://compsci.ca/v3/uploads/user_avatars/16932914504cbd0ad6ceaf1.jpg)
|
Posted: Wed Jun 04, 2008 6:41 am Post subject: RE:Sniper Game |
|
|
I posted an example in my previous post.
use the arrow keys (up or down) untill you see the sniper logo, then use the spacebar to go into snipemode. |
|
|
|
|
![](images/spacer.gif) |
Tallguy
![](http://compsci.ca/v3/uploads/user_avatars/515706924539b443d32a6e.gif)
|
Posted: Thu Jun 05, 2008 7:42 am Post subject: RE:Sniper Game |
|
|
i know, i need winrar though........... |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
SNIPERDUDE
![](http://compsci.ca/v3/uploads/user_avatars/16932914504cbd0ad6ceaf1.jpg)
|
Posted: Thu Jun 05, 2008 10:32 am Post subject: RE:Sniper Game |
|
|
not too hard to download, you pretty much only need to google it.
I'll see if I can find my code and let you know how I did it.
EDIT: Hmmm, aparrantly I just did drawoval and used a drawfill to colour the outer part black.
(That doesn't work in all cases, only if you don't have any black in your background, but if you do
just draw your scope using a similar colour that isn't colour 7 [use 255 for ex]))
You could achieve the same effect if you made a pic and drew it on top.
so first you would draw your background
then draw the sniper scope using picMerge
Hope that helps |
|
|
|
|
![](images/spacer.gif) |
andrew.
|
Posted: Fri Jun 20, 2008 10:22 pm Post subject: RE:Sniper Game |
|
|
Sorry I'm late, but don't use WinRAR, use 7-zip. I find it's a lot faster and better than WinRAR and it's free! |
|
|
|
|
![](images/spacer.gif) |
SNIPERDUDE
![](http://compsci.ca/v3/uploads/user_avatars/16932914504cbd0ad6ceaf1.jpg)
|
Posted: Sat Jun 21, 2008 7:41 am Post subject: RE:Sniper Game |
|
|
I'll look into it, thanks!
![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
Zeppelin
![](http://compsci.ca/v3/uploads/user_avatars/9053317224742204e85b5a.gif)
|
Posted: Sat Jul 12, 2008 12:18 am Post subject: Re: Sniper Game |
|
|
I was planing to make a game like this and I might start up again. Anyways the way I did it is that I found some reference images using google and I used paint to colour everything but the reticle white and save it as a gif file. Although you could probably do the same thing with a could of draw.line commands and making a giant white circle in paint but if you want a scope like the one on the SVD I think this is the easiest way.
PS. If you want I could upload the ones I have on a site like Imageshack if you want them. |
|
|
|
|
![](images/spacer.gif) |
SNIPERDUDE
![](http://compsci.ca/v3/uploads/user_avatars/16932914504cbd0ad6ceaf1.jpg)
|
Posted: Sat Jul 12, 2008 6:15 am Post subject: RE:Sniper Game |
|
|
I'm bringing up my old shooting game too, I think it needs a freck lick of paint...
And everything else too, So I'm starting from scratch. |
|
|
|
|
![](images/spacer.gif) |
Zeppelin
![](http://compsci.ca/v3/uploads/user_avatars/9053317224742204e85b5a.gif)
|
Posted: Sat Jul 12, 2008 6:19 pm Post subject: Re: Sniper Game |
|
|
Forget what I said before. I thought it would work but when I tried it it failed completely.
EDIT: Forget my last sentance I got it to work. |
|
|
|
|
![](images/spacer.gif) |
SNIPERDUDE
![](http://compsci.ca/v3/uploads/user_avatars/16932914504cbd0ad6ceaf1.jpg)
|
Posted: Sat Jul 12, 2008 9:14 pm Post subject: RE:Sniper Game |
|
|
* fresh.
Can't edit what's been replied to... |
|
|
|
|
![](images/spacer.gif) |
|