Comments (6)
On updating the bullet, it will need to draw out a line to the destination, checking collision at each tile, and step (if tile is not empty). An easy way to do it is to give it a suitable speed, then update in a loop until its range is complete.
To represent, add a bullet attribute IsHitscan
. This way we can still reuse the speed/range variables for pushback and range calculation.
For drawing, we'd probably want a new attribute: HitscanFrames
. This controls which % of the flight path we want to draw the bullet sprite per frame. That is, if the value is 3, the first frame will draw the bullet 1/4 of the way between shooter and target, the second frame 1/2, and the third frame 3/4. Add a random offset so repeated shots actually look like an unbroken path instead of discrete points. Will probably need to experiment with this to get it to look right.
Weapon ideas:
- Laser
- ~~~Rework the nuke fun gun to use laser indicator~~~ Add laser pointer
- Stun gun (short range, petrify effect - rework petrify to an electrocute effect instead?)
from cdogs-sdl.
Depends on #372
Since hitscan weapons play nicer with antilag, we may want to change some existing weapons to be hitscan too, like:
- Pulse rifle
- Pistol
- New shotgun?
- New sniper?
Also, with the addition of bullet mass (#444) it doesn't make sense to use speed/range anymore. Instead:
Speed
="Inf"
- not really valid JSON double, but since we're parsing usingatof
, this worksRange
still used, but purely for animation now (see comments on theHitscanFrames
)RangeHitscan
used for the actual range now, in subpixel units
from cdogs-sdl.
Actually, with #372 (almost) done, hitscan weapons aren't any different from normal weapons - they just move really fast. So they are still represented using Speed
and Range
- range just being 1 usually for an instantaneous movement, and Speed
being how many subpixel units they move.
But then there's the question of how to draw the trail. This could be done using SDL_RenderCopyEx, possibly with a new TrailPic
attribute. But be careful - SDL_RenderCopyEx may not be compatible everywhere.
from cdogs-sdl.
Another cheap option is to draw a simple line with SDL_RenderDrawLine
from cdogs-sdl.
This is actually going to depend on #440, since trails need to be part of the map, occluded by walls etc.
from cdogs-sdl.
Warning: GCW-Zero has a bug where SDL_RenderCopyEx is broken - it always renders unrotated at 0,0. Will need a workaround, or disable trails for GCW-Zero.
from cdogs-sdl.
Related Issues (20)
- AArms
- Character health loss amount text
- Bombs interaction with explosions and fire
- Changing weapons while standing still HOT 1
- Bombs slot resetting
- Proximity mines over character after placement
- Friendly fire on Distress call from scientific outpost HOT 1
- Wrong mission title
- Poison
- Wrong menu loading
- Impossible to close some menus
- Typos HOT 2
- Multiple map objects per destroy objective HOT 1
- Add correct aspect ratio option
- Petrify Gun
- Check for shared ENet if USE_SHARED_ENET is set HOT 5
- Shift to another hasmap implementation from the deprecated `c_hashmap` HOT 2
- Wrong blood animation HOT 3
- Original Release Campaign? HOT 7
- CVE-apply:In Nanopb before versions 0.3.9.8 and 0.4.5, decoding a specifically formed message can cause invalid `free()` or `realloc()` calls if the message type contains an `oneof` field, and the `oneof` directly contains both a pointer field and a non-pointer field. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cdogs-sdl.