-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
74 additions
and
44 deletions.
There are no files selected for viewing
Binary file modified
BIN
+305 Bytes
(160%)
fanta-is-awesome/bin/com/siegedog/hava/derpygame/DoNothingPickup.class
Binary file not shown.
Binary file modified
BIN
+94 Bytes
(100%)
fanta-is-awesome/bin/com/siegedog/hava/derpygame/GameplayScreen.class
Binary file not shown.
Binary file modified
BIN
+1.42 KB
(240%)
fanta-is-awesome/bin/com/siegedog/hava/derpygame/PickupNode.class
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions
7
fanta-is-awesome/src/com/siegedog/hava/derpygame/DoNothingPickup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
package com.siegedog.hava.derpygame; | ||
|
||
import com.siegedog.hava.engine.RenderNode2D; | ||
|
||
public class DoNothingPickup extends PickupNode | ||
{ | ||
// fields | ||
|
||
|
||
RenderNode2D renderNode; | ||
|
||
// ctors | ||
|
||
public DoNothingPickup(int posX, int posY, int sizeX, int sizeY) | ||
{ | ||
super("imma do nothing", posX, posY, sizeX, sizeY); | ||
|
||
renderNode = new RenderNode2D("data/img/sprites/penis.png", 32, 32); | ||
addNode(renderNode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 62 additions & 41 deletions
103
fanta-is-awesome/src/com/siegedog/hava/derpygame/PickupNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,89 @@ | ||
package com.siegedog.hava.derpygame; | ||
|
||
import java.util.List; | ||
|
||
import com.siegedog.hava.engine.*; | ||
import com.badlogic.gdx.graphics.Texture; | ||
import com.badlogic.gdx.graphics.g2d.Sprite; | ||
import com.badlogic.gdx.physics.box2d.Contact; | ||
import com.badlogic.gdx.physics.box2d.ContactImpulse; | ||
import com.badlogic.gdx.physics.box2d.ContactListener; | ||
import com.badlogic.gdx.physics.box2d.Manifold; | ||
import com.badlogic.gdx.physics.box2d.MassData; | ||
|
||
public class PickupNode extends BoxNode | ||
{ | ||
// fields | ||
|
||
BoxNode box; | ||
ContactListener listener; | ||
|
||
// public methods | ||
|
||
// ctors | ||
|
||
public PickupNode(String name, int posX, int posY, int sizeX, int sizeY) | ||
@Override | ||
public void update(float delta) | ||
{ | ||
super(null, null); | ||
setPosition(posX, posY); | ||
setDimensions(sizeX, sizeY); | ||
if (world.getContactCount() == 0) | ||
{ | ||
System.out.println("no contacts"); | ||
return; | ||
} | ||
|
||
world.setContactListener(listener = new ContactListener() { | ||
List<Contact> contacts = world.getContactList(); | ||
for (Contact c : contacts) | ||
{ | ||
BoxNode o1 = (BoxNode)c.getFixtureA().getUserData(); | ||
BoxNode o2 = (BoxNode)c.getFixtureB().getUserData(); | ||
|
||
@Override | ||
public void beginContact(Contact contact) { | ||
Object o1 = contact.getFixtureA().getUserData(); | ||
Object o2 = contact.getFixtureB().getUserData(); | ||
|
||
LRR player = null; | ||
PickupNode pickup = null; | ||
if(o1 instanceof LRR && o2 instanceof PickupNode ) | ||
{ | ||
player = (LRR)o1; | ||
pickup = (PickupNode)o2; | ||
} | ||
else | ||
{ | ||
if(o2 instanceof LRR && o1 instanceof PickupNode) | ||
{ | ||
player = (LRR)o2; | ||
pickup = (PickupNode)o1; | ||
} | ||
} | ||
LRR player = null; | ||
PickupNode pickup = null; | ||
if(o1.getParent() != null && o1.getParent() instanceof LRR) | ||
{ | ||
player = (LRR)o1.getParent(); | ||
} | ||
if(o2.getParent() != null && o2.getParent() instanceof LRR) | ||
{ | ||
player = (LRR)o2.getParent(); | ||
} | ||
if(o1 instanceof PickupNode) | ||
{ | ||
pickup = (PickupNode)o1; | ||
|
||
if(player != null && pickup != null) | ||
{ | ||
player.applyPickup(pickup); | ||
} | ||
} | ||
|
||
@Override | ||
public void endContact(Contact contact) { | ||
if(o2 instanceof PickupNode) | ||
{ | ||
pickup = (PickupNode)o2; | ||
|
||
} | ||
|
||
@Override | ||
public void postSolve(Contact contact, ContactImpulse impulse) { | ||
|
||
|
||
if(player != null) | ||
{ | ||
System.out.println("player found"); | ||
} | ||
|
||
@Override | ||
public void preSolve(Contact contact, Manifold oldManifold) { | ||
if(pickup != null) | ||
{ | ||
System.out.println("pickup found"); | ||
} | ||
|
||
if(player != null && pickup != null) | ||
{ | ||
//player.applyPickup(pickup); | ||
} | ||
}); | ||
} | ||
|
||
} | ||
|
||
|
||
// ctors | ||
|
||
public PickupNode(String name, int posX, int posY, int sizeX, int sizeY) | ||
{ | ||
super(null, null); | ||
|
||
setPosition(posX, posY); | ||
setDimensions(sizeX, sizeY); | ||
|
||
this.body.setGravityScale(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters