Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
stillonearth committed Jun 10, 2024
1 parent 02b383b commit ea19e99
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/entities/characters/enemy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ pub fn handle_enemy_hit(
enemies.get_mut(event.entity).unwrap();
let enemy_position = mierda_transform.translation;
let vector_attack = (enemy_position - player_position).normalize();
enemy_velocity.linvel.x += vector_attack.x * 200.;
enemy_velocity.linvel.y += vector_attack.y * 200.;
enemy_velocity.linvel.x += vector_attack.x * 500.;
enemy_velocity.linvel.y += vector_attack.y * 500.;

let damage = match enemy.enemy_type {
EnemyType::Mierda => (1.0 * event.damage as f32) as u16,
Expand Down
8 changes: 3 additions & 5 deletions src/entities/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,12 @@ pub fn handle_machete_attack(
if machete_timer.just_finished() {
let player_position = transform.translation;

for (entity, mierda_transform, _) in
q_enemies.iter_mut().filter(|(_, _, m)| !m.is_dummy)
{
for (_, mierda_transform, _) in q_enemies.iter_mut().filter(|(_, _, m)| !m.is_dummy) {
let mierda_position = mierda_transform.translation;

let distance = player_position.distance(mierda_position);

if distance >= 40. {
if distance >= 45. {
continue;
}

Expand Down Expand Up @@ -179,7 +177,7 @@ pub fn event_player_attack(

let distance = player_position.distance(mierda_position);

if distance >= 40. {
if distance >= 45. {
continue;
}

Expand Down
73 changes: 41 additions & 32 deletions src/gameplay/waves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,40 +240,49 @@ pub fn ui_wave_info_text(
// Composition of wave events
pub fn get_level_1_waves() -> Vec<Wave> {
vec![
Wave {
events: vec![WaveEntry::Mierda { count: 200 }],
// events: vec![WaveEntry::Boss { count: 1 }],
event_duration: Duration::from_secs(30),
wave_duration: Duration::from_secs(30),
},
Wave {
events: vec![
WaveEntry::Mierda { count: 200 },
WaveEntry::Pizza { count: 5 },
WaveEntry::Mierda { count: 300 },
WaveEntry::Biboran { count: 5 },
WaveEntry::Mierda { count: 400 },
],
event_duration: Duration::from_secs(10),
wave_duration: Duration::from_secs(60),
},
Wave {
events: vec![
WaveEntry::Pendejo { count: 200 },
WaveEntry::Pizza { count: 3 },
WaveEntry::Pendejo { count: 200 },
WaveEntry::Pizza { count: 3 },
WaveEntry::Pendejo { count: 200 },
WaveEntry::Pizza { count: 3 },
WaveEntry::Pendejo { count: 200 },
WaveEntry::Pizza { count: 3 },
WaveEntry::Pendejo { count: 200 },
WaveEntry::Pizza { count: 3 },
WaveEntry::Pendejo { count: 200 },
WaveEntry::Pizza { count: 3 },
WaveEntry::Pendejo { count: 200 },
WaveEntry::Pizza { count: 3 },
WaveEntry::Pendejo { count: 200 },
WaveEntry::Pizza { count: 3 },
],
event_duration: Duration::from_secs(5),
wave_duration: Duration::from_secs(120),
},
Wave {
events: vec![WaveEntry::Boss { count: 1 }],
event_duration: Duration::from_secs(100),
wave_duration: Duration::from_secs(100),
event_duration: Duration::from_secs(5),
wave_duration: Duration::from_secs(120),
},
// Wave {
// events: vec![
// WaveEntry::Mierda { count: 100 },
// WaveEntry::Pizza { count: 3 },
// WaveEntry::Mierda { count: 100 },
// WaveEntry::Biboran { count: 1 },
// WaveEntry::Mierda { count: 100 },
// ],
// event_duration: Duration::from_secs(20),
// wave_duration: Duration::from_secs(80),
// },
// Wave {
// events: vec![
// WaveEntry::Mierda { count: 200 },
// WaveEntry::Pizza { count: 3 },
// WaveEntry::Pendejo { count: 200 },
// WaveEntry::Mierda { count: 200 },
// WaveEntry::Pizza { count: 3 },
// WaveEntry::Biboran { count: 1 },
// WaveEntry::Pendejo { count: 200 },
// WaveEntry::Mierda { count: 200 },
// WaveEntry::Pizza { count: 3 },
// WaveEntry::Biboran { count: 1 },
// WaveEntry::Pendejo { count: 200 },
// WaveEntry::Biboran { count: 1 },
// WaveEntry::Pizza { count: 3 },
// ],
// event_duration: Duration::from_secs(20),
// wave_duration: Duration::from_secs(260),
// },
]
}
80 changes: 75 additions & 5 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ pub(crate) fn draw_ui(mut commands: Commands, asset_server: Res<AssetServer>) {
.insert(UIPlayerHealth);
});

// Weapon

// Weapon - Gun
commands
.spawn((
NodeBundle {
Expand All @@ -117,7 +116,7 @@ pub(crate) fn draw_ui(mut commands: Commands, asset_server: Res<AssetServer>) {
..default()
},
UIGamePlay,
Name::new("Weapon image"),
Name::new("Weapon gun image"),
))
.with_children(|parent| {
parent.spawn((
Expand All @@ -141,7 +140,78 @@ pub(crate) fn draw_ui(mut commands: Commands, asset_server: Res<AssetServer>) {
style: Style {
position_type: PositionType::Absolute,
justify_content: JustifyContent::FlexStart,
bottom: Val::Px(75.0),
bottom: Val::Px(15.0),
right: Val::Px(20.0),
padding: UiRect {
right: Val::Px(75.0),
..default()
},
align_items: AlignItems::FlexStart,
..default()
},
..default()
},
UIGamePlay,
Name::new("Weapon name"),
))
.with_children(|parent| {
parent.spawn((
TextBundle::from_section(
"SPEARGUN LV 1",
TextStyle {
font: asset_server.load("fonts/PixeloidMono-d94EV.ttf"),
font_size: 20.0,
color: Color::WHITE,
},
),
UIWeaponName,
));
});

// Weapon - Machete
commands
.spawn((
NodeBundle {
style: Style {
position_type: PositionType::Absolute,
justify_content: JustifyContent::FlexStart,
bottom: Val::Px(100.0),
right: Val::Px(10.0),
padding: UiRect {
right: Val::Px(75.0),
..default()
},
align_items: AlignItems::FlexStart,
..default()
},
..default()
},
UIGamePlay,
Name::new("Weapon machete image"),
))
.with_children(|parent| {
parent.spawn((
NodeBundle {
style: Style {
width: Val::Px(320.0),
height: Val::Px(45.0),
// margin: UiRect::top(Val::VMin(5.)),
..default()
},
background_color: Color::WHITE.into(),
..default()
},
UiImage::new(asset_server.load("sprites/machete.png")),
));
});

commands
.spawn((
NodeBundle {
style: Style {
position_type: PositionType::Absolute,
justify_content: JustifyContent::FlexStart,
bottom: Val::Px(85.0),
right: Val::Px(20.0),
padding: UiRect {
right: Val::Px(75.0),
Expand All @@ -158,7 +228,7 @@ pub(crate) fn draw_ui(mut commands: Commands, asset_server: Res<AssetServer>) {
.with_children(|parent| {
parent.spawn((
TextBundle::from_section(
"SPEARGUN level 1",
"MACHETE LV 1",
TextStyle {
font: asset_server.load("fonts/PixeloidMono-d94EV.ttf"),
font_size: 20.0,
Expand Down

0 comments on commit ea19e99

Please sign in to comment.