Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split room #2

Open
wants to merge 270 commits into
base: split-room-g
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
270 commits
Select commit Hold shift + click to select a range
3e1a47f
dut
huydsai02 Jun 19, 2023
798f439
add explosion effects
lggvu Jun 19, 2023
98a76d1
add weapons and effects
lggvu Jun 22, 2023
a3e087d
fix bullet size
lggvu Jun 22, 2023
1d994e4
add jungler character
lggvu Jun 22, 2023
87ece63
add dying effect - adventurer
lggvu Jun 23, 2023
a5db33e
update assassin char + dying effects
lggvu Jun 23, 2023
eab657e
update
huydsai02 Jun 23, 2023
8c43c56
Merge branch 'characters-animation' into split-room
huydsai02 Jun 23, 2023
03c4b20
update defaut texture
huydsai02 Jun 23, 2023
e868829
temp update
huydsai02 Jun 23, 2023
1444427
update load feature gson
huydsai02 Jun 24, 2023
be3b73d
update draw weapon
huydsai02 Jun 24, 2023
044c01f
explosion update
huydsai02 Jun 24, 2023
8b8f107
update shot explosion
huydsai02 Jun 24, 2023
adab4a3
update for fps
huydsai02 Jun 24, 2023
0fc0d9c
update remove bullet exceed range
huydsai02 Jun 24, 2023
32994a7
update telegate
huydsai02 Jun 24, 2023
c87ebee
update tele size
huydsai02 Jun 24, 2023
9104346
Update Player.java
huydsai02 Jun 24, 2023
fe34666
temp fix map 2
huydsai02 Jun 24, 2023
78cae8f
add attribute efffect
huydsai02 Jun 25, 2023
33493a8
update boom deal dame
huydsai02 Jun 25, 2023
78174a0
update temp
huydsai02 Jun 25, 2023
cfd08c9
update super boom
huydsai02 Jun 25, 2023
0723544
update gun
huydsai02 Jun 25, 2023
b2fce33
update load function
huydsai02 Jun 25, 2023
aa76806
add assassin immortal
huydsai02 Jun 25, 2023
0b5c8ff
add select-char-screen and choose difficulty (visual)
sg-nta Jun 25, 2023
7f4ab1c
update adventurer skill
huydsai02 Jun 25, 2023
886c538
add select-char-screen and choose difficulty (visual)
sg-nta Jun 26, 2023
ad26db4
.
huydsai02 Jun 26, 2023
95701ed
update full screen
huydsai02 Jun 26, 2023
3443077
temp update
huydsai02 Jun 26, 2023
a6e71cf
Merge branch 'select_char_screen' into split-room
huydsai02 Jun 26, 2023
ddfd27c
merge select char
huydsai02 Jun 26, 2023
ba32e11
update cooldown
huydsai02 Jun 26, 2023
927ad29
remove redundant element
huydsai02 Jun 26, 2023
1e18b3c
add poison, fire
huydsai02 Jun 27, 2023
b2855a0
add character collision
huydsai02 Jun 27, 2023
a33f8b5
update multi bullet
huydsai02 Jun 27, 2023
8826ac2
bouncing bullet
huydsai02 Jun 27, 2023
51e08d4
update chase bullet
huydsai02 Jun 27, 2023
98ea9bd
fix collide
huydsai02 Jun 27, 2023
671467c
update vision
huydsai02 Jun 27, 2023
56b76d6
update shot explosion sprite and fix bullet size
lggvu Jun 27, 2023
b17d3c6
update vision for monster
huydsai02 Jun 28, 2023
9c22fa8
Merge branch 'split-room' of https://github.com/lggvu/SE-Soul-Knight …
huydsai02 Jun 28, 2023
e54f40d
Merge branch 'split-room' of https://github.com/lggvu/SE-Soul-Knight …
huydsai02 Jun 28, 2023
d977080
add bot
huydsai02 Jun 28, 2023
e3d2ed2
fix chase bullet
huydsai02 Jun 28, 2023
c17a00a
update sword effect
huydsai02 Jun 28, 2023
f3a763e
enum for effect
huydsai02 Jun 28, 2023
23dc9de
temp update
huydsai02 Jun 28, 2023
c991b09
update ability
huydsai02 Jun 28, 2023
1f53fbb
temp update
huydsai02 Jun 29, 2023
156284a
add element immunity
huydsai02 Jun 29, 2023
33ad49d
add lightning effect
huydsai02 Jun 29, 2023
ca070f2
update region
huydsai02 Jun 29, 2023
031e3b4
update dodge temp
huydsai02 Jun 30, 2023
331f2ad
update json
huydsai02 Jun 30, 2023
2809f4a
update json
huydsai02 Jun 30, 2023
c3559a0
update error version
huydsai02 Jun 30, 2023
636b5dc
update
huydsai02 Jun 30, 2023
ddbb14b
fix bug
huydsai02 Jun 30, 2023
705e8b4
fix boss
huydsai02 Jun 30, 2023
bd27d46
update texture
huydsai02 Jun 30, 2023
617e01e
update fix bullet
huydsai02 Jun 30, 2023
b2a77a6
update map
giangng1902 Jun 30, 2023
a19422e
update map
giangng1902 Jun 30, 2023
8fff4e8
update map3
giangng1902 Jun 30, 2023
488d151
update
huydsai02 Jul 1, 2023
f0eaabb
fix collide bug
huydsai02 Jul 1, 2023
a2302ef
fux bug
huydsai02 Jul 1, 2023
cd0cb86
update select ability
huydsai02 Jul 1, 2023
36a5ee4
update select ability
huydsai02 Jul 1, 2023
c8b4361
fix bug assasin
huydsai02 Jul 1, 2023
d53f615
update
huydsai02 Jul 1, 2023
37cd7e5
fix tele gate
huydsai02 Jul 1, 2023
42f3cde
update texture
huydsai02 Jul 1, 2023
734ad9e
update weapon load
huydsai02 Jul 1, 2023
995a967
update melee weapon
huydsai02 Jul 2, 2023
c82297b
temp update
huydsai02 Jul 2, 2023
557ba1e
adventurer dodge effect
lggvu Jul 2, 2023
70a0d87
adventurer dodge effect
lggvu Jul 2, 2023
e889eee
Merge remote-tracking branch 'origin/split-room' into split-room
lggvu Jul 2, 2023
061e3e1
adventurer separated dodge effect
lggvu Jul 2, 2023
8f5d046
temp update
huydsai02 Jul 2, 2023
a1e76b8
temp update
huydsai02 Jul 2, 2023
a6c55f2
temp update
huydsai02 Jul 2, 2023
4c4393c
fix some bug
huydsai02 Jul 2, 2023
6afe2db
update flyig eye
huydsai02 Jul 2, 2023
763ae8e
update texture
huydsai02 Jul 2, 2023
aff64e3
complete map3
giangng1902 Jul 2, 2023
56754ad
update version
huydsai02 Jul 2, 2023
f282a7c
update adventure texture
lggvu Jul 2, 2023
b858651
Merge remote-tracking branch 'origin/split-room' into split-room
lggvu Jul 2, 2023
c8216d1
Merge branch 'split-room' into create-map
huydsai02 Jul 2, 2023
8504f5c
update adventure dodges
lggvu Jul 2, 2023
6ecfca8
fix
huydsai02 Jul 2, 2023
46e99cc
temp update
huydsai02 Jul 2, 2023
4be1b44
update assassin texture
lggvu Jul 2, 2023
41e6f98
lai la commit
lggvu Jul 2, 2023
fb65621
adventurer dying and me dying too
lggvu Jul 2, 2023
a238ea9
assassin dying
lggvu Jul 2, 2023
b8e271c
temp update
huydsai02 Jul 2, 2023
683fcd4
Merge branch 'split-room' of https://github.com/lggvu/SE-Soul-Knight …
huydsai02 Jul 2, 2023
59fc532
temp update
huydsai02 Jul 2, 2023
65da7ea
update map1
giangng1902 Jul 2, 2023
6382751
update width
huydsai02 Jul 3, 2023
152a882
update dying
huydsai02 Jul 3, 2023
ed39d5b
update temp
huydsai02 Jul 3, 2023
c7bbb73
update map
giangng1902 Jul 3, 2023
db87eb1
update maps
giangng1902 Jul 3, 2023
8b56312
update maps
giangng1902 Jul 3, 2023
ba32c94
...
phongtran263 Jul 4, 2023
b62a60e
fdfsa
huydsai02 Jul 4, 2023
5adb64e
fix bug
huydsai02 Jul 4, 2023
70a3c06
fix loi em Huy
khanh14ph Jul 4, 2023
50db021
new monsters
lggvu Jul 4, 2023
a58dd3e
update setting
huydsai02 Jul 4, 2023
862b325
Merge branch 'split-room' of https://github.com/lggvu/SE-Soul-Knight …
huydsai02 Jul 4, 2023
e295bb7
reupdate settings
huydsai02 Jul 4, 2023
349fede
update flame demon
lggvu Jul 4, 2023
ac5aeaa
update map4
giangng1902 Jul 4, 2023
0383804
update map4
giangng1902 Jul 4, 2023
37a53cf
create map 2
giangng1902 Jul 4, 2023
71a4a3f
temp update
huydsai02 Jul 5, 2023
735bec6
Merge branch 'split-room' into create-map
huydsai02 Jul 5, 2023
dc9a291
resize map1
giangng1902 Jul 5, 2023
d7fce7b
update map3
giangng1902 Jul 5, 2023
d2291a2
update
huydsai02 Jul 5, 2023
c4e1d47
fix assassin spec skill
lggvu Jul 5, 2023
f0e3a52
fix collision 2.0
khanh14ph Jul 5, 2023
72dba97
update fix bug
huydsai02 Jul 5, 2023
b2bb8af
add endgamescreen and exit game in pause
sg-nta Jul 5, 2023
187e820
fix bug
huydsai02 Jul 5, 2023
220263d
fix collision 2.0
khanh14ph Jul 5, 2023
9c2edd5
update map2
giangng1902 Jul 5, 2023
bd9a4f8
Merge branch 'create-map' of https://github.com/lggvu/SE-Soul-Knight …
giangng1902 Jul 5, 2023
7bca457
map5
giangng1902 Jul 5, 2023
e7817ab
fix collision 3.0
khanh14ph Jul 5, 2023
8f9c258
update
huydsai02 Jul 5, 2023
3586046
Merge remote-tracking branch 'origin/fix_collision' into split-room
huydsai02 Jul 5, 2023
db545c0
update dying
huydsai02 Jul 5, 2023
263bde7
update monsters
lggvu Jul 5, 2023
280d2b2
temp update
huydsai02 Jul 5, 2023
cc3c376
Merge branch 'split-room' of https://github.com/lggvu/SE-Soul-Knight …
huydsai02 Jul 5, 2023
8a3e7a3
temp fux
huydsai02 Jul 5, 2023
c35f579
increase dying size - daco
lggvu Jul 5, 2023
7d5ada5
Merge remote-tracking branch 'origin/split-room' into split-room
lggvu Jul 5, 2023
68c8586
update boss
huydsai02 Jul 5, 2023
5a41528
add sounds
sg-nta Jul 5, 2023
261cbe8
add sounds
sg-nta Jul 5, 2023
a32c33d
add sounds
sg-nta Jul 5, 2023
58b1f74
fix some bug
huydsai02 Jul 5, 2023
c544511
update sound
huydsai02 Jul 5, 2023
2420500
refactor
huydsai02 Jul 5, 2023
133cc7d
update boss
huydsai02 Jul 5, 2023
376044a
temp update
huydsai02 Jul 5, 2023
7738329
temp update
huydsai02 Jul 5, 2023
b1d0cf8
update map2
giangng1902 Jul 5, 2023
0b5c2e8
update map2
giangng1902 Jul 5, 2023
4af802f
temp update state dict
huydsai02 Jul 6, 2023
bf54cb7
temp update
huydsai02 Jul 6, 2023
85bb27d
update screen
huydsai02 Jul 6, 2023
3cffeed
update
huydsai02 Jul 6, 2023
05a74e6
update remove state dict when end game
huydsai02 Jul 6, 2023
e992310
fix bug
huydsai02 Jul 6, 2023
1c46398
update
huydsai02 Jul 6, 2023
a00f7e5
temp update
huydsai02 Jul 6, 2023
8c2bab9
update new poison weapons
lggvu Jul 6, 2023
08fba84
temp fix
huydsai02 Jul 6, 2023
f7e1994
map2
phongtran263 Jul 6, 2023
432db87
map2
phongtran263 Jul 6, 2023
7dd92e9
temp fix
huydsai02 Jul 6, 2023
ef0958a
hud bars
lggvu Jul 6, 2023
e7f1f55
update map5
giangng1902 Jul 6, 2023
ca62df2
temp update
huydsai02 Jul 7, 2023
41ead80
update hud
lggvu Jul 7, 2023
a7660a4
temp update
huydsai02 Jul 7, 2023
3f0f50e
map3
phongtran263 Jul 7, 2023
7f18af0
map2
phongtran263 Jul 7, 2023
7d77e42
update stats
huydsai02 Jul 7, 2023
fc4af2b
map4
phongtran263 Jul 7, 2023
dca1d7b
map4
phongtran263 Jul 7, 2023
4e1ae75
Merge branch 'create-map' into add_monsters
phongtran263 Jul 7, 2023
c3aabd9
update endgame
lggvu Jul 7, 2023
7e66ab9
Merge remote-tracking branch 'origin/split-room' into split-room
lggvu Jul 7, 2023
77f04b3
map5
phongtran263 Jul 7, 2023
7bacf38
temp
khanh14ph Jul 8, 2023
f2d5019
update win lose
huydsai02 Jul 8, 2023
b95f3ac
update delete state dict
huydsai02 Jul 8, 2023
dd71606
update next map
huydsai02 Jul 8, 2023
914ef06
add backend leaderboard
huydsai02 Jul 8, 2023
5961d08
temp update dispose
huydsai02 Jul 8, 2023
cb2fd74
fix weapons OP
lggvu Jul 8, 2023
bed8656
update
huydsai02 Jul 8, 2023
8efa372
Merge branch 'split-room' of https://github.com/lggvu/SE-Soul-Knight …
huydsai02 Jul 8, 2023
0d0ae53
update
huydsai02 Jul 8, 2023
e484a4c
fix collision 3.0
khanh14ph Jul 8, 2023
f553d0d
update dying flame monster, fix monster strength
lggvu Jul 8, 2023
98a696c
add leader board
huydsai02 Jul 8, 2023
f3da970
Merge branch 'split-room' of https://github.com/lggvu/SE-Soul-Knight …
huydsai02 Jul 8, 2023
df9ae04
temp update
huydsai02 Jul 8, 2023
823e821
add sounds
sg-nta Jul 8, 2023
3218760
Update SelectCharacterScreen.java
huydsai02 Jul 8, 2023
1b8c443
update
huydsai02 Jul 8, 2023
eafe3e9
fix effect bug
huydsai02 Jul 8, 2023
57e3509
fix shape
huydsai02 Jul 8, 2023
a70ca5f
adventurer select
lggvu Jul 8, 2023
6be54bb
adventurer select
lggvu Jul 8, 2023
9914a13
Merge remote-tracking branch 'origin/split-room' into split-room
lggvu Jul 8, 2023
68830b1
Merge branch 'add_monsters' into split-room
huydsai02 Jul 8, 2023
727ab60
Merge branch 'split-room' of https://github.com/lggvu/SE-Soul-Knight …
huydsai02 Jul 8, 2023
eadb590
update random weapon
huydsai02 Jul 8, 2023
e36e139
fix bug
huydsai02 Jul 8, 2023
8923e76
update map5
giangng1902 Jul 8, 2023
a112b87
update map5
giangng1902 Jul 8, 2023
b1db4b1
update select background
lggvu Jul 8, 2023
2cdc0bf
Merge branch 'split-room' of https://github.com/lggvu/SE-Soul-Knight …
giangng1902 Jul 8, 2023
4705619
update map4
giangng1902 Jul 8, 2023
4d41eb1
fix collision 3.0
khanh14ph Jul 8, 2023
fc3ab3b
update
huydsai02 Jul 8, 2023
be48da6
fix collision 3.0
khanh14ph Jul 8, 2023
7472035
Merge remote-tracking branch 'origin/minato' into split-room
huydsai02 Jul 8, 2023
9f4616f
fix some bug
huydsai02 Jul 8, 2023
c082a2c
update
huydsai02 Jul 8, 2023
a2ebde3
fix map
huydsai02 Jul 8, 2023
ef09aa6
new background
giangng1902 Jul 8, 2023
9f83761
update skills description
lggvu Jul 8, 2023
a5d8675
fix sword
huydsai02 Jul 9, 2023
ad5b0a9
fix stupid kunai
huydsai02 Jul 9, 2023
fe49a65
update version auto save
huydsai02 Jul 9, 2023
a522ea6
fix jungler
huydsai02 Jul 9, 2023
433b8ce
temp update
huydsai02 Jul 9, 2023
2252720
temp update
huydsai02 Jul 9, 2023
8847639
update jungler
huydsai02 Jul 9, 2023
76adf19
update background
lggvu Jul 9, 2023
347cc2a
update
huydsai02 Jul 9, 2023
d43efd1
temp update
huydsai02 Jul 9, 2023
0588ab7
temp update
huydsai02 Jul 9, 2023
f8918b2
fix bug lose game
huydsai02 Jul 9, 2023
691eb33
add exit button
sg-nta Jul 9, 2023
9689cd3
fix gun red s
huydsai02 Jul 9, 2023
9ea3c57
fix gun bug
huydsai02 Jul 9, 2023
da627d9
rename
huydsai02 Jul 9, 2023
b93774b
blank background
lggvu Jul 9, 2023
ba04404
update background
huydsai02 Jul 9, 2023
2250667
update weapon
huydsai02 Jul 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add bot
  • Loading branch information
huydsai02 committed Jun 28, 2023
commit d977080a4b95f3a7795056d40603a5d2412471aa
10 changes: 5 additions & 5 deletions assets/info/character_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@
"teacher": {
"type": "boss",
"texture_path": "character/img1.png",
"hp": 20,
"hp": 30,
"speed_run": 30,
"default_weapon": "Gun Monster 1",
"width": 32,
"height": 32,
"weapon_x": 16,
"weapon_y": 16
"width": 64,
"height": 64,
"weapon_x": 32,
"weapon_y": 32
}
}
4 changes: 2 additions & 2 deletions core/src/com/mygdx/soulknight/SoulKnight.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public class SoulKnight extends Game {

@Override
public void create () {
// Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
batch = new SpriteBatch();
this.setScreen(new MainGameScreen(this, new Adventurer()));
this.setScreen(new MenuScreen(this));
}
@Override
public void render () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public Adventurer() {
specialGun.addDirectionAttack(45, 90, 135, 180, 235, 270, 315);
specialGun.setOwner(this);
specialGun.setDrawGun(false);
totalTimeImplement = specialSkillCoolDown / 2;
specialSkillCoolDown = 1f;
totalTimeImplement = specialSkillCoolDown * 5;
}
@Override
public void applySpecialSkill(float deltaTime) {
Expand Down
127 changes: 79 additions & 48 deletions core/src/com/mygdx/soulknight/entity/Character/Boss.java
Original file line number Diff line number Diff line change
@@ -1,82 +1,113 @@
package com.mygdx.soulknight.entity.Character;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.mygdx.soulknight.entity.Map.Room;
import com.mygdx.soulknight.entity.Map.WorldMap;
import com.mygdx.soulknight.entity.Weapon.Bullet;
import com.mygdx.soulknight.entity.Weapon.Gun;
import com.mygdx.soulknight.entity.Weapon.Weapon;
import com.mygdx.soulknight.specialskill.Barrage;
import com.mygdx.soulknight.specialskill.SpecialSkill;
import com.mygdx.soulknight.util.SpriteLoader;

public class Boss extends Monster {
private SpecialSkill skill;
public Boss(String characterName, WorldMap map, Room room) {
super(characterName, map,room);
}
private float timeShotAgain = 2f;
private float currentTimeCount = 1f;
public Boss(String characterName, WorldMap map, Room room) {
super(characterName, map, room);
weapons.clear();
// gun_1 chase (đạn chậm 100f)
// gun_2 bắn xung quanh (đạn trung bình 300f)
// gun_3 đạn nảy (đạn trung bình 300f, nảy 3 lần)
Gun gun_1 = new Gun("weapon/sword.png", "bullet/bullet4.png", "bullet-effects/Shot3/shot3-sheet_1_8.png", "bullet-effects/Shot3/shot3-sheet_1_8.png", 2, 0, 2f, 1000, 0.3f, 100f);
gun_1.setDegreeChangePerSec(120f);
Gun gun_2 = new Gun("weapon/sword.png", "bullet/bullet3.png", "bullet-effects/Shot3/shot3-sheet_1_8.png", "bullet-effects/Shot3/shot3-sheet_1_8.png", 2, 0, 2f, 500, 0.3f, 300f);
Gun gun_3 = new Gun("weapon/sword.png", "bullet/bullet5.png", "bullet-effects/Shot3/shot3-sheet_1_8.png", "bullet-effects/Shot3/shot3-sheet_1_8.png", 2, 0, 2f, 3000, 0.3f, 300f);
gun_3.setNumWallCollide(3);
gun_1.setDrawGun(false);
gun_2.setDrawGun(false);
gun_3.setDrawGun(false);
for (int i = -30; i <= 30; i+=5) {
if (i == 0) {continue;}
gun_1.addDirectionAttack(i);
gun_2.addDirectionAttack(i);
gun_3.addDirectionAttack(i);
}

@Override
public JsonObject load() {
JsonObject source = super.load();
Barrage barrage = new Barrage(Boss.this, "bullet/bullet5.png", 5, 3f, 100f, 999999f);
this.setSkill((SpecialSkill)barrage);
return source;
}
for (int i = 90; i <= 150; i+=5) {
gun_2.addDirectionAttack(i);
}

private void setSkill(SpecialSkill skill) {
this.skill = skill;

}
for (int i = -90; i >= -150; i-=5) {
gun_2.addDirectionAttack(i);
}
weapons.add(gun_1);
weapons.add(gun_2);
weapons.add(gun_3);
for (Weapon weapon : weapons) {
weapon.setOwner(this);
}
}

@Override
@Override
public void update(float deltaTime) {
getCurrentWeapon().update(deltaTime);
applyEffect(deltaTime);
currentTimeCount += deltaTime;
for (Weapon weapon : weapons) {
weapon.update(deltaTime);
}
if (isStunned) {
return;
}

float playerX = map.getPlayer().getX();
float playerY = map.getPlayer().getY();
float distance = (float) Math.sqrt(Math.pow(playerX - getX(), 2) + Math.pow(playerY - getY(), 2));
if (distance <= this.attackRadius) {
if (distance <= this.attackRadius && map.getPlayer().isInVision(this)) {
setSpeedRun(speedInRangeAttack);
Vector2 direction = new Vector2(playerX - getX(), playerY - getY()).nor();
if (direction.x != 0 || direction.y != 0) {
move(direction.x, direction.y, deltaTime);
}
this.skill.activate();

if (currentTimeCount >= timeShotAgain) {
currentTimeCount = 0;
this.attack(direction);
switchWeapon();
}
}
else {
// The monster will move randomly if the player is not in the attack radius
for (int i = 0; i < 40; i++) {
float testX = this.getX() + lastMoveDirection.x * speedRun * deltaTime;
float testY = this.getY() + lastMoveDirection.y * speedRun * deltaTime;
if (!map.isMapCollision(new Rectangle(testX, testY, width, height)) && (lastMoveDirection.x != 0 || lastMoveDirection.y != 0)) {
move(lastMoveDirection.x, lastMoveDirection.y, deltaTime);
break;
}
this.setSpeedRun(this.speedWhenIdle);
setSpeedRun(speedWhenIdle);
float testX = this.getX() + lastMoveDirection.x * speedRun * deltaTime;
float testY = this.getY() + lastMoveDirection.y * speedRun * deltaTime;
if (!map.isMapCollision(new Rectangle(testX, testY, width, height)) && (lastMoveDirection.x != 0 || lastMoveDirection.y != 0)) {
move(lastMoveDirection.x, lastMoveDirection.y, deltaTime);
} else {
lastMoveDirection = new Vector2(MathUtils.random(-100, 100), MathUtils.random(-100, 100)).nor();

}
}
this.skill.update(deltaTime);
if (currentTimeCount >= timeShotAgain) {
currentTimeCount = 0;
if (lastMoveDirection != null && (lastMoveDirection.x != 0 || lastMoveDirection.y != 0)) {
this.attack(lastMoveDirection);
} else {
this.attack(new Vector2(1, 0));
}
switchWeapon();
}
}

@Override
public void draw(SpriteBatch batch) {
super.draw(batch);
this.skill.draw(batch);

}
@Override
public void attack(Vector2 direction) {

}

public SpecialSkill getSkill() {
return this.skill;
for (Weapon weapon : weapons) {
if (!weapon.equals(getCurrentWeapon())) {
if (weapon instanceof Gun) {
for (Bullet bullet : ((Gun) weapon).getBulletArrayList()) {
bullet.draw(batch);
}
}
}
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.mygdx.soulknight.util.SpriteLoader;

public class Monster extends SimpleCharacter {
float attackRadius = 200;
protected float attackRadius = 200;
float speedWhenIdle; // The speed that monster will move when cannot approach the player
float speedInRangeAttack;
private Room room;
Expand Down
9 changes: 1 addition & 8 deletions core/src/com/mygdx/soulknight/entity/Character/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.mygdx.soulknight.entity.Weapon.Bullet;
import com.mygdx.soulknight.entity.Weapon.Gun;
import com.mygdx.soulknight.entity.Weapon.Weapon;
import com.mygdx.soulknight.specialskill.SpecialSkill;
import com.mygdx.soulknight.util.SpriteLoader;
import com.badlogic.gdx.Input;

Expand Down Expand Up @@ -50,6 +49,7 @@ public Player(String characterName, WorldMap map) {
public JsonObject load() {
JsonObject source = super.load();
this.maxArmor = source.get("armor").getAsInt();
maxArmor = Integer.MAX_VALUE;
this.currentArmor = this.maxArmor;
this.maxMana = source.get("energy").getAsInt();
setCurrentMana(maxMana);
Expand Down Expand Up @@ -340,13 +340,6 @@ public ArrayList<Pickable> autoCollect() {
return collectItem;
}

public void switchWeapon() {
currentWeaponId++;
if (currentWeaponId >= weapons.size()) {
currentWeaponId = 0;
}
}

public int getMaxArmor() {
return maxArmor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ public boolean equals(Object object) {
return false;
}

public void switchWeapon() {
currentWeaponId++;
if (currentWeaponId >= weapons.size()) {
currentWeaponId = 0;
}
}

protected void applyEffect(float deltaTime) {
this.isStunned = false;
ArrayList<CharacterEffect> removeList = new ArrayList<>();
Expand Down
12 changes: 9 additions & 3 deletions core/src/com/mygdx/soulknight/entity/Weapon/Bullet.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class Bullet {
private float height = 17;
private TextureRegion bulletTexture;
private int numDestroyObject = 1;
private int numWallCollide = 2;
private int numWallCollide = 1;
private int numEnemyHit = 1;
private float distanceLeft = 500f;
private ArrayList<String> effectsName;
Expand Down Expand Up @@ -53,15 +53,21 @@ public float getX() {
public float getY() {
return y;
}

public Bullet(SimpleCharacter owner, TextureRegion bulletTexture, float x, float y, Vector2 direction, float speed, ArrayList<String> effectsName) {
public Bullet(SimpleCharacter owner, TextureRegion bulletTexture, float x, float y,
Vector2 direction, float speed, ArrayList<String> effectsName, int numDestroyObject,
int numEnemyHit, int numWallCollide, float degreeChangePerSec, float distanceLeft) {
this.x = x - width / 2;
this.y = y - height / 2;
this.direction = direction.nor();
this.bulletTexture = bulletTexture;
this.speed = speed;
this.effectsName = effectsName;
this.owner = owner;
this.numDestroyObject = numDestroyObject;
this.numWallCollide = numWallCollide;
this.numEnemyHit = numEnemyHit;
this.degreeChangePerSec = degreeChangePerSec;
this.distanceLeft = distanceLeft;
}
public void update(float deltaTime) {
if (degreeChangePerSec != 0) {
Expand Down
24 changes: 23 additions & 1 deletion core/src/com/mygdx/soulknight/entity/Weapon/Gun.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public class Gun extends Weapon {
protected TextureRegion bulletTextureRegion;
protected Animation<TextureRegion> explosionAnimation;
protected Animation<TextureRegion> shotExplosionAnimation;
private int numDestroyObject = 1;
private int numWallCollide = 1;
private int numEnemyHit = 1;
private float degreeChangePerSec = 0;
protected ArrayList<Float> directionAttack = new ArrayList<>(Arrays.asList(0f));
protected boolean drawGun = true;

Expand Down Expand Up @@ -55,8 +59,26 @@ protected void shot(Vector2 direction) {
gunBarrelX += (width - origin_x) * MathUtils.cosDeg(degree);
gunBarrelY += (width - origin_x) * MathUtils.sinDeg(degree);
owner.getMap().createAnExplosion(owner, gunBarrelX, gunBarrelY, 15, this.shotExplosionAnimation, false);
bulletArrayList.add(new Bullet(owner, bulletTextureRegion, gunBarrelX, gunBarrelY, direction, bulletSpeed, effectsName));
bulletArrayList.add(new Bullet(owner, bulletTextureRegion, gunBarrelX, gunBarrelY, direction,
bulletSpeed, effectsName, numDestroyObject, numEnemyHit, numWallCollide, degreeChangePerSec, rangeWeapon));
}

public void setNumDestroyObject(int numDestroyObject) {
this.numDestroyObject = numDestroyObject;
}

public void setNumWallCollide(int numWallCollide) {
this.numWallCollide = numWallCollide;
}

public void setNumEnemyHit(int numEnemyHit) {
this.numEnemyHit = numEnemyHit;
}

public void setDegreeChangePerSec(float degreeChangePerSec) {
this.degreeChangePerSec = degreeChangePerSec;
}

@Override
public void attack(Vector2 direction) {
if (isAllowedAttack()) {
Expand Down
6 changes: 4 additions & 2 deletions core/src/com/mygdx/soulknight/entity/Weapon/Weapon.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ public static Weapon load(String weaponName, String infoPath) {
float bulletSpeed = properties.get("bullet_speed").getAsFloat();
Gun gun = new Gun(source.get("gun_texture").getAsString(), bulletTexturePath, explosionTexturePath, shotExplosionTexturePath, damage, energyCost, attackSpeed, range, criticalRate, bulletSpeed);
gun.setSize(width, height);
gun.setRotateCenter(origin_x, origin_y);
// gun.setRotateCenter(origin_x, origin_y);
gun.addEffects(effectsName);
gun.setRotateCenter(origin_x, height / 2);
JsonElement jsonElement = source.get("attack_directions");
if (jsonElement != null) {
Iterator<JsonElement> directions = jsonElement.getAsJsonArray().iterator();
Expand All @@ -171,7 +172,8 @@ else if (source.get("type").getAsString().equals("Sword")) {
);
sword.setEffectFrames(frames);
sword.setSize(width, height);
sword.setRotateCenter(origin_x, origin_y);
sword.setRotateCenter(origin_x, height / 2);
// sword.setRotateCenter(origin_x, origin_y);
sword.addEffects(effectsName);
return sword;
}
Expand Down
Loading