Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
941 changes: 597 additions & 344 deletions android/assets/Maps/Level-1.tmx

Large diffs are not rendered by default.

483 changes: 483 additions & 0 deletions android/assets/Maps/Level-12.tmx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion android/assets/Maps/Level-2.tmx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<layer name="Background-Water&amp;Lava" width="130" height="33">
<layer name="Background-Water;Lava" width="130" height="33">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
Expand Down
Binary file added android/assets/Maps/Tiles/oppcastle-tiles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
160 changes: 160 additions & 0 deletions android/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 90 additions & 0 deletions android/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions android/local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sun May 14 18:42:44 MSK 2017
sdk.dir=C\:\\Users\\User\\AppData\\Local\\Android\\Sdk
26 changes: 16 additions & 10 deletions core/src/com/spbstu/android/game/objects/Rope.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

public class Rope {
private Array<Joint> joint = new Array<Joint>();
public enum ropeState{
isRest, inFlight, isRoped
}


public boolean isExist;
public boolean inFlight = false;
public boolean isRoped = false;
private ropeState state = ropeState.isRest;
private Sprite spriteRope;
public float yRopedBlock, xRopedBlock;
private float H, L, alpha, alphaRad;
Expand All @@ -47,7 +47,7 @@ public void buildJoint(World world, float x, float y, Body playerBody, boolean b
possibleY = playerBody.getPosition().y*PPM ;// + PPM *(float) Math.sin(alpha);;
if (playerBody.getPosition().x * PPM > x)
alpha = (float) (Math.PI - alpha);
for (int i = 0; i < 8*L / PPM; i++) {
for (int i = 0; i < 8*L / PPM + 16; i++) {
possibleX += PPM/8 * Math.cos(alpha);
possibleY += PPM/8 * Math.sin(alpha);
if(possibleY > (blocksMap.length-1) *PPM)
Expand All @@ -59,11 +59,10 @@ public void buildJoint(World world, float x, float y, Body playerBody, boolean b
if (blocksMap[(int) Math.floor((possibleY) / PPM)][(int) Math.floor((possibleX) / PPM) ]) {
xRopedBlock = possibleX;
yRopedBlock = possibleY;
if(isRoped)
if(state == ropeState.isRoped)
destroyJoint(world);
isRoped = true;
state = ropeState.isRoped;
buildRopeJoints(world,createBox(world,(xRopedBlock /*+ 2*PPM*/) / PPM, yRopedBlock / PPM, 0.2f/PPM, 0.2f/ PPM, false), playerBody);
isExist = true;
break;
}
}
Expand Down Expand Up @@ -128,7 +127,6 @@ public void destroyJoint(World world) {
for(int i = 0; i< joint.size; i++)
world.destroyBody(joint.get(i).getBodyA());
joint.clear();
isExist = false;
}
private void getParams(Body body){
H = yRopedBlock - body.getPosition().y * PPM;
Expand All @@ -148,7 +146,7 @@ private void getParams(Body body){

public void render(SpriteBatch batch, Body body) { //рисую веревку, рисую, где хочу, законом не запрещено
float alphaLinks, lLinks = 0;
if (isRoped) {
if (state == ropeState.isRoped) {
batch.begin();
getParams(body);
for(int i = 0; i < joint.size; i++) {
Expand All @@ -170,8 +168,16 @@ public void render(SpriteBatch batch, Body body) { //рисую веревку,
batch.end();
}
}
public void setRopeState(ropeState state){
this.state = state;
}
public ropeState getRopeState(){
return state;
}

public static float norm(double x1, double x2, double y1, double y2) {
return (float)Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2));
}


}
Loading