Skip to content

Commit

Permalink
Added : sprites to spells blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
kalahel committed Jan 6, 2018
1 parent 2a7d59f commit 429e5ae
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/src/main/java/com/app/remi/test/engine/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
Expand All @@ -20,6 +22,7 @@
import android.view.WindowManager;
import android.widget.Toast;

import com.app.remi.test.R;
import com.app.remi.test.activities.MainMenuActivity;
import com.app.remi.test.network.backend.services.NetworkBackendService;
import com.app.remi.test.soundServices.BallBounceService;
Expand Down Expand Up @@ -130,8 +133,10 @@ public Engine(Context context, Boolean playWithSensor, SensorManager sensorManag
double xposition = screenX * 0.1 + (i * (70 / numberSpellBlocks * 3) + (i * (150 / numberSpellBlocks * 3)));
if (!MainMenuActivity.BRICKEST_OFFLINE_MODE) {
String name = ownPlayer.getSelectedSpells().get(i);

spellBlock = new SpellBlock(screenX, screenY, xposition, screenY * 0.3, 150 / numberSpellBlocks * 3, 150 / numberSpellBlocks * 3, name);


} else {
spellBlock = new SpellBlock(screenX, screenY, xposition, screenY * 0.3, 150 / numberSpellBlocks * 3, 150 / numberSpellBlocks * 3, "spellblock" + i + 1);

Expand Down Expand Up @@ -204,8 +209,16 @@ public void draw() {
for (int i = 0; i < listeB.size(); i++)
canvas.drawRect(listeB.get(i).getRect(), paint);

for (int i = 0; i < listeS.size(); i++)
for (int i = 0; i < listeS.size(); i++) {
canvas.drawRect(listeS.get(i).getRect(), paint);
if(!MainMenuActivity.BRICKEST_OFFLINE_MODE) {
// Drawing of the spells blocks sprites
String spriteName = listeS.get(i).getSpell() + "_sprite";
Bitmap bitmapSpell = BitmapFactory.decodeResource(getResources(), getResources().getIdentifier(spriteName, "drawable", mainActivityContext.getPackageName()));
canvas.drawBitmap(bitmapSpell, null, listeS.get(i).getRect(), null);
}

}

//this is the HUD
canvas.drawRect(0, (float) (screenY * 0.2), screenX, 0, paint);
Expand Down
64 changes: 64 additions & 0 deletions app/src/main/java/com/app/remi/test/engine/SpellBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,68 @@ public float getCooldownDuration() {
public void setCooldownDuration(float cooldownDuration) {
this.cooldownDuration = cooldownDuration;
}

public void setLeftSide(RectF leftSide) {
this.leftSide = leftSide;
}

public void setRightSide(RectF rightSide) {
this.rightSide = rightSide;
}

public void setTopSide(RectF topSide) {
this.topSide = topSide;
}

public void setBotSide(RectF botSide) {
this.botSide = botSide;
}

public int getWidth() {
return width;
}

public void setWidth(int width) {
this.width = width;
}

public int getHeight() {
return height;
}

public void setHeight(int height) {
this.height = height;
}

public double getxPosition() {
return xPosition;
}

public void setxPosition(double xPosition) {
this.xPosition = xPosition;
}

public double getyPosition() {
return yPosition;
}

public void setyPosition(double yPosition) {
this.yPosition = yPosition;
}

public int getxScreen() {
return xScreen;
}

public void setxScreen(int xScreen) {
this.xScreen = xScreen;
}

public int getyScreen() {
return yScreen;
}

public void setyScreen(int yScreen) {
this.yScreen = yScreen;
}
}

0 comments on commit 429e5ae

Please sign in to comment.