Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Lee
ball-gfx-hal
Commits
30d987c3
Commit
30d987c3
authored
Jan 29, 2019
by
Benjamin Lee
💬
Browse files
Added option to have players die when they touch their own cursor.
parent
c0f888b5
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/game/mod.rs
View file @
30d987c3
...
...
@@ -38,6 +38,7 @@ pub struct GameSettings {
pub
ball_start_distance
:
f32
,
pub
ball_start_speed
:
f32
,
pub
bounds_radius
:
f32
,
pub
kill_own_cursor
:
bool
,
}
impl
Default
for
GameSettings
{
...
...
@@ -49,6 +50,7 @@ impl Default for GameSettings {
ball_start_distance
:
0.3
,
ball_start_speed
:
1.0
,
bounds_radius
:
1.0
,
kill_own_cursor
:
false
,
}
}
}
...
...
src/game/server.rs
View file @
30d987c3
...
...
@@ -231,9 +231,9 @@ impl Game {
if
let
Some
(
cursor
)
=
player
.state.cursor
{
let
circle_cursor
=
physics
::
cursor
(
cursor
,
settings
);
for
(
&
id_ball
,
player_ball
)
in
self
.players
.iter
()
{
if
id
==
id_ball
{
// Don't let players kill themselves
.
//
TODO make th
is
c
on
figurable
if
id
==
id_ball
&&
!
settings
.kill_own_cursor
{
// Don't let players kill themselves
//
unless that setting
is on
.
continue
;
}
...
...
src/networking/server.rs
View file @
30d987c3
...
...
@@ -403,7 +403,6 @@ impl Server {
let
dt
=
dt
.as_float_secs
()
as
f32
;
self
.timer
.set_timeout
(
interval
,
TimeoutState
::
Tick
);
debug!
(
"stepping game tick (dt={})"
,
dt
);
let
events
=
self
.game
.tick
(
dt
);
self
.send_events
(
events
)
?
;
...
...
src/state.rs
View file @
30d987c3
...
...
@@ -15,7 +15,7 @@ use crate::networking::{
use
easer
::
functions
::
*
;
use
gfx_hal
::
Backend
;
use
imgui
::{
im_str
,
ImString
,
Ui
};
use
log
::{
error
,
warn
};
use
log
::{
debug
,
error
,
warn
};
use
nalgebra
::
Point2
;
use
palette
::
LinSrgb
;
use
std
::
iter
;
...
...
@@ -557,7 +557,15 @@ impl GameState {
&
mut
settings
.bounds_radius
,
)
.build
();
changed
|
=
ui
.checkbox
(
im_str!
(
"players can kill own cursor"
),
&
mut
settings
.kill_own_cursor
,
);
if
changed
{
debug!
(
"sending updated settings: {:?}"
,
settings
);
game
.set_settings
(
settings
);
}
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment