Skip to content

Commit

Permalink
Fixed .gitignore and added melee animations
Browse files Browse the repository at this point in the history
  • Loading branch information
Tipaa committed Mar 9, 2012
1 parent 7cba078 commit 76b088a
Show file tree
Hide file tree
Showing 19 changed files with 1,107 additions and 1,096 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ build
*.sw?
lib/.tmp/
doc/
*.db
Empty file modified res/art/player/start_lordlard_big.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 40 additions & 40 deletions src/com/mojang/mojam/entity/BulletBuckshot.java
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
package com.mojang.mojam.entity;

import com.mojang.mojam.entity.mob.*;
import com.mojang.mojam.screen.*;

public class BulletBuckshot extends Bullet {

public BulletBuckshot(Mob owner, double xa, double ya, float damage) {
super(owner, ya, ya, damage);
this.owner = owner;
pos.set(owner.pos.x + xa * 4, owner.pos.y + ya * 4);
this.xa = xa * 18;
this.ya = ya * 18;
this.setSize(2, 2);
physicsSlide = false;
duration = 20;
this.damage = damage;
}

@Override
public void tick() {
if (--duration <= 0) {
remove();
return;
}
if (!move(xa, ya)) {
hit = true;
}
if (hit && !removed) {
remove();
}
if(damage > 0.5)
damage -= 0.5;
}

@Override
public void render(Screen screen) {
screen.blit(Art.buckShot, pos.x - 8, pos.y - 8);
}
}
package com.mojang.mojam.entity;

import com.mojang.mojam.entity.mob.*;
import com.mojang.mojam.screen.*;

public class BulletBuckshot extends Bullet {

public BulletBuckshot(Mob owner, double xa, double ya, float damage) {
super(owner, ya, ya, damage);
this.owner = owner;
pos.set(owner.pos.x + xa * 4, owner.pos.y + ya * 4);
this.xa = xa * 18;
this.ya = ya * 18;
this.setSize(2, 2);
physicsSlide = false;
duration = 20;
this.damage = damage;
}

@Override
public void tick() {
if (--duration <= 0) {
remove();
return;
}
if (!move(xa, ya)) {
hit = true;
}
if (hit && !removed) {
remove();
}
if(damage > 0.5)
damage -= 0.5;
}

@Override
public void render(Screen screen) {
screen.blit(Art.buckShot, pos.x - 8, pos.y - 8);
}
}
22 changes: 16 additions & 6 deletions src/com/mojang/mojam/entity/BulletMelee.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,38 @@

public class BulletMelee extends Bullet
{

public int color = 0xffcc9966;

public BulletMelee(Mob e, double xa, double ya, float damage, int range)
{
super(e, xa, ya, damage);
duration = range;
}

public BulletMelee(Mob e, double xa, double ya, float damage, int range, int color)
{
this(e, xa, ya, damage, range);
this.color = color;
}

@Override
public void tick()
{
if (--duration <= 0) {
if(--duration <= 0)
{
remove();
return;
}
}
super.tick();
}

@Override
public void render(Screen screen)
{
//super.render(screen);
//TODO: Effects
screen.rectangle((int) pos.x - 3, (int) pos.y - 3, 6, 6, color);
screen.rectangle((int) pos.x - 2, (int) pos.y - 2, 4, 4, color);
screen.rectangle((int) pos.x - 1, (int) pos.y - 1, 2, 2, color);
}

}
74 changes: 37 additions & 37 deletions src/com/mojang/mojam/entity/BulletPoison.java
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
package com.mojang.mojam.entity;

import com.mojang.mojam.MojamComponent;
import com.mojang.mojam.entity.building.Building;
import com.mojang.mojam.entity.mob.Mob;
import com.mojang.mojam.screen.Art;
import com.mojang.mojam.screen.Screen;

public class BulletPoison extends Bullet {

public BulletPoison(Mob e, double xa, double ya, float damage) {
super(e, xa, ya, damage);
duration=80;
this.xa = xa * 3;
this.ya = ya * 3;

}

@Override
public void render(Screen screen) {
screen.blit(Art.bulletpoison[facing][0], pos.x - 8, pos.y - 10);
}

@Override
public void collide(Entity entity, double xa, double ya) {
if (entity instanceof Mob) {
Mob mobEnt = (Mob) entity;
if (mobEnt.isNotFriendOf(owner) && !(entity instanceof Building)) {
mobEnt.hurt(this,damage);
hit = true;
}
}
if (hit) {
MojamComponent.soundPlayer.playSound("/sound/Shot 2.wav", (float) pos.x, (float) pos.y);
}
}

package com.mojang.mojam.entity;

import com.mojang.mojam.MojamComponent;
import com.mojang.mojam.entity.building.Building;
import com.mojang.mojam.entity.mob.Mob;
import com.mojang.mojam.screen.Art;
import com.mojang.mojam.screen.Screen;

public class BulletPoison extends Bullet {

public BulletPoison(Mob e, double xa, double ya, float damage) {
super(e, xa, ya, damage);
duration=80;
this.xa = xa * 3;
this.ya = ya * 3;

}

@Override
public void render(Screen screen) {
screen.blit(Art.bulletpoison[facing][0], pos.x - 8, pos.y - 10);
}

@Override
public void collide(Entity entity, double xa, double ya) {
if (entity instanceof Mob) {
Mob mobEnt = (Mob) entity;
if (mobEnt.isNotFriendOf(owner) && !(entity instanceof Building)) {
mobEnt.hurt(this,damage);
hit = true;
}
}
if (hit) {
MojamComponent.soundPlayer.playSound("/sound/Shot 2.wav", (float) pos.x, (float) pos.y);
}
}

}
136 changes: 68 additions & 68 deletions src/com/mojang/mojam/entity/BulletRay.java
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
package com.mojang.mojam.entity;

import com.mojang.mojam.entity.mob.*;
import com.mojang.mojam.network.TurnSynchronizer;
import com.mojang.mojam.screen.*;

public class BulletRay extends Bullet {
private int maxBounceNumber;
private double previuosPositionX, previuosPositionY;
private int frame;

public BulletRay(Mob e, double xa, double ya, float damage) {
super(e, ya, ya, damage);
this.owner = e;
pos.set(e.pos.x + xa * 4, e.pos.y + ya * 4);
this.xa = xa * 5;
this.ya = ya * 5;
this.setSize(4, 4);
physicsSlide = false;
duration = 50;
maxBounceNumber = 5;
frame = 0;
this.damage = damage;
}

@Override
public void tick() {
previuosPositionX = pos.x;
previuosPositionY = pos.y;
if (--duration <= 0) {
remove();
return;
}
if (!move(xa, ya)) {
if(maxBounceNumber > 0) {
//Bounce
if(previuosPositionX != pos.x) {
ya = -ya;
}
if(previuosPositionY != pos.y) {
xa = -xa;
}
if(previuosPositionY == pos.y && previuosPositionX == pos.x) {
xa = -xa;
ya = -ya;
}

//Increase the speed, duration and damage with each bounce
xa *= 1.2;
ya *= 1.2;
duration += 5;
damage *= 1.5;

maxBounceNumber--;
}
else hit = true;
}
if (hit && !removed) {
remove();
}
frame = TurnSynchronizer.synchedRandom.nextInt(8);
}

@Override
public void render(Screen screen) {
screen.blit(Art.plasmaBall[frame][0], (int)pos.x - 8, (int)pos.y - 10);
}
}
package com.mojang.mojam.entity;

import com.mojang.mojam.entity.mob.*;
import com.mojang.mojam.network.TurnSynchronizer;
import com.mojang.mojam.screen.*;

public class BulletRay extends Bullet {
private int maxBounceNumber;
private double previuosPositionX, previuosPositionY;
private int frame;

public BulletRay(Mob e, double xa, double ya, float damage) {
super(e, ya, ya, damage);
this.owner = e;
pos.set(e.pos.x + xa * 4, e.pos.y + ya * 4);
this.xa = xa * 5;
this.ya = ya * 5;
this.setSize(4, 4);
physicsSlide = false;
duration = 50;
maxBounceNumber = 5;
frame = 0;
this.damage = damage;
}

@Override
public void tick() {
previuosPositionX = pos.x;
previuosPositionY = pos.y;
if (--duration <= 0) {
remove();
return;
}
if (!move(xa, ya)) {
if(maxBounceNumber > 0) {
//Bounce
if(previuosPositionX != pos.x) {
ya = -ya;
}
if(previuosPositionY != pos.y) {
xa = -xa;
}
if(previuosPositionY == pos.y && previuosPositionX == pos.x) {
xa = -xa;
ya = -ya;
}

//Increase the speed, duration and damage with each bounce
xa *= 1.2;
ya *= 1.2;
duration += 5;
damage *= 1.5;

maxBounceNumber--;
}
else hit = true;
}
if (hit && !removed) {
remove();
}
frame = TurnSynchronizer.synchedRandom.nextInt(8);
}

@Override
public void render(Screen screen) {
screen.blit(Art.plasmaBall[frame][0], (int)pos.x - 8, (int)pos.y - 10);
}
}
46 changes: 23 additions & 23 deletions src/com/mojang/mojam/entity/building/ShopItemRaygun.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package com.mojang.mojam.entity.building;

import com.mojang.mojam.MojamComponent;
import com.mojang.mojam.entity.Player;
import com.mojang.mojam.entity.weapon.Raygun;
import com.mojang.mojam.gui.Notifications;
import com.mojang.mojam.screen.Art;

public class ShopItemRaygun extends ShopItem {

public ShopItemRaygun(double x, double y, int team) {
super("raygun",x, y, team, 800, 5);
setSprite(Art.weaponList[2][0]);
teamTooltipYOffset = (team == 2) ? 122 : -32;
}

public void useAction(Player player) {
if(!player.weaponInventory.add(new Raygun(player))) {
if(this.team == MojamComponent.localTeam) {
Notifications.getInstance().add(MojamComponent.texts.getStatic("gameplay.weaponAlready"));
}
}
}
package com.mojang.mojam.entity.building;

import com.mojang.mojam.MojamComponent;
import com.mojang.mojam.entity.Player;
import com.mojang.mojam.entity.weapon.Raygun;
import com.mojang.mojam.gui.Notifications;
import com.mojang.mojam.screen.Art;

public class ShopItemRaygun extends ShopItem {

public ShopItemRaygun(double x, double y, int team) {
super("raygun",x, y, team, 800, 5);
setSprite(Art.weaponList[2][0]);
teamTooltipYOffset = (team == 2) ? 122 : -32;
}

public void useAction(Player player) {
if(!player.weaponInventory.add(new Raygun(player))) {
if(this.team == MojamComponent.localTeam) {
Notifications.getInstance().add(MojamComponent.texts.getStatic("gameplay.weaponAlready"));
}
}
}
}
Loading

0 comments on commit 76b088a

Please sign in to comment.