This site requires JavaScript, please enable it in your browser!
Greenfoot back

Comments for Sniper Fi

Return to Sniper Fi

JetLennitJetLennit

2013/10/14

i am exited for this!
danpostdanpost

2013/10/14

@JetLennit, do not you mean 'excited' (you are not leaving, are you... lol).
KartoffelbrotKartoffelbrot

2013/10/14

:D
A new version of this scenario was uploaded on Mon Oct 14 15:24:10 UTC 2013 Added the game: - Civilians, cars, leaders - Snipe Scope - Shooting and bullets
A new version of this scenario was uploaded on Mon Oct 14 15:47:28 UTC 2013 More screens and stuff
joeschmoejoeschmoe

2013/10/14

Anyone know where I can get a good gun shot sound effect?
A new version of this scenario was uploaded on Mon Oct 14 16:00:55 UTC 2013 added tag C7O13B
SPowerSPower

2013/10/14

You should make the sniper actually zoom into what it sees, and make the mouse be really at the middle of the sniper :)
danpostdanpost

2013/10/14

I believe there is one in Builderboy's 'Nightmare: Emergence' scenario (http://www.greenfoot.org/scenarios/2017).
If you want a zoom effect, you can look at my Magnification scenario. However, it only magnifies the background image. Not actors.
danpostdanpost

2013/10/15

To create a zoom effect properly with so many actors will unfortunately end up very laggy. Just using 'getIntersectingObjects' on the magnifier, I believe will display the intersectors from top-left to bottom-right by their world coordinates (not by the order placed in the world). I do not know if there are any other ways to solve this except by the following. You would have to use 'getWorld().getObjects(null)' and iterate through that list to see if the list returned by 'getIntersectingObjects' contains each object and paint them in the order found (this would be a time consumer). This still does not do anything for any 'setPaintOrder' you may have set. If you wish to see an example, I can upload one.
One thing I was thinking of here (and something I've thought for my Magnifying glass as well) is have a class or something in the world that looks at all the actors, and adds their picture to the world bakground, and never really adds the actors to the world (or they're really somewhere else). I'm not sure how laggy this would get, and I'd probably need to make a subclass for actor too. The problem here is that there's a lot of actors. It'd probably work fine with a few, but it'd get laggy here. Maybe I can have it specifically change actors within a certain range of the actor? I'll be working on that possibly tonight and later this week.
SPowerSPower

2013/10/15

You can also just draw all the actors that you want to magnify onto a copy of your background image, and magnify that image. That way you still add actors to the world, so collision detection still works.
Oh, and you have to post source code as well at some point (challenge rules). Also that'd help when I try implementing the Magnifying methods to a large amount of actors, if you really want to do that with your scenario.
SPowerSPower

2013/10/15

@joeschmoe I think my magnifier class is fast enough to do the job: http://www.greenfoot.org/scenarios/9618
SPowerSPower

2013/10/15

@danpost The key to making it fast was only drawing and scaling the actors that the magnifier can see, not all the ones in the world.
danpostdanpost

2013/10/15

@SPower, I stated that the list from getObjects would need be iterated through and only draw the actor if the list from 'getIntersectingObjects' contains that element. Therefore, you are only drawing those actors that are intersecting the magnifying glass. This process is needed so that the intersecting objects can be drawn in the proper order.
danpostdanpost

2013/10/15

@SPower, would you mind if I uploaded my version of a magnifying glass?
SPowerSPower

2013/10/15

@danpost sorry for my bad reading again, and of course I won't mind! The more programmers, the more fun!
danpostdanpost

2013/10/15

OK, it is located at the following location: http://www.greenfoot.org/scenarios/9622
joeschmoejoeschmoe

2013/10/15

Okay, thanks for all the awesome examples guys! I'm work a little on this now and let you know how it goes
A new version of this scenario was uploaded on Tue Oct 15 20:08:15 UTC 2013 - Added a slight zoom, needs a lot of work. - Made Open Source - Thanked Danpost for code - Added more to screens, started making more levels but will release them soone enough - Re-drew scope to make it more even, but it still needs to be evened more. - Asked people to chill out because this is a WIP! - Had some lemonade
Make sure you put the zoom OVER the other actors. Do that with setPaintOrder().
By the way, looking pretty good so far
danpostdanpost

2013/10/15

I noticed that you are using my XWorld XActor super-classes; but not using them to there full advantage. For details, start a discussion thread and name it something like "On 'Sniper Fi' by joeschmoe". Then indicate here that it was started (I will probably see it anyway; but, it might help for others to see it).
A new version of this scenario was uploaded on Thu Oct 17 00:36:20 UTC 2013 changed paint order