Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Sniper Game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Tallguy




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
Vermette




PostPosted: 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.
SNIPERDUDE




PostPosted: 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...
Insectoid




PostPosted: 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!
Tallguy




PostPosted: Tue Jun 03, 2008 11:10 am   Post subject: RE:Sniper Game

does anyone have an example that i could look at?
andrew.




PostPosted: 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.
SNIPERDUDE




PostPosted: 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.
Tallguy




PostPosted: Thu Jun 05, 2008 7:42 am   Post subject: RE:Sniper Game

i know, i need winrar though...........
Sponsor
Sponsor
Sponsor
sponsor
SNIPERDUDE




PostPosted: 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
andrew.




PostPosted: 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!
SNIPERDUDE




PostPosted: Sat Jun 21, 2008 7:41 am   Post subject: RE:Sniper Game

I'll look into it, thanks!
Smile
Zeppelin




PostPosted: 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.
SNIPERDUDE




PostPosted: 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.
Zeppelin




PostPosted: 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.
SNIPERDUDE




PostPosted: Sat Jul 12, 2008 9:14 pm   Post subject: RE:Sniper Game

* fresh.

Can't edit what's been replied to...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 15 Posts ]
Jump to:   


Style:  
Search: