Skip to content

Commit

Permalink
Merge pull request #19 from waynemwashuma/dev
Browse files Browse the repository at this point in the history
0.5.0 build
  • Loading branch information
waynemwashuma authored Nov 15, 2023
2 parents 9b5bfcc + 1846915 commit 2b5ff6d
Show file tree
Hide file tree
Showing 261 changed files with 54,135 additions and 46,186 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ res.json
*.mp3
tests
*.res.js
*.txt
*.txt
animations
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@

- Added a changelog.
- Fixed path behaviour where agent doesn't advance to the next path.
- Manager is now created though createManager().
- Entity.Default() has been moved to createEntity()
- Manager is now created though `createManager()`.
- `Entity.Default()` has been moved to `createEntity()`

### v0.5.1

- Added signals to the events through `Sigbal()` class.
- Renamed `Vec2()` to `Vector2()`
- Fixed `Overlap.AABBvsSphere()` to return the correct value.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,17 @@ game.add(ground)

## **** FUTURE WORK ****

- Add a webgl renderer(dont have a direct plan for this yet)🟠
- Stabilize the collision response to work well with large forces such as (gravity = 10000)
- Stabilize rotational stacking in the physics engine
- Add game state class for managing the game
- Add an animation system.
- Add tutorials to this game engine
- Add appropriate demos to the project and get a website running for them 🟠
- Add some error handling mechanisms 🟠
- Add Serialization/Deserialization of objects(on the way) 🟠
- Kinematic bodies.
- Collision masking using bits(bit masking)
- More AI behaviors.
- Add indexedDB to Storage API.
- An audio tag fallback to Web audio (if necessary )
[] Add a webgl renderer(~~dont have a direct plan for this yet~~ Now i do :) )
[]Stabilize the collision response to work well with large forces such as (gravity = 10000)
[]Stabilize rotational stacking in the physics engine
[]~~Add game state class for managing the game~~
[]Add an animation system.
[]Add tutorials to this game engine
[]Add appropriate demos to the project and get a website running for them
[]Add some error handling mechanisms
[x]Add Serialization/Deserialization of objects(on the way)
[]Kinematic bodies.
[]Collision masking using bits(bit masking)
[]More AI behaviors.
[]Add indexedDB to Storage API.
[]An audio tag fallback to Web audio (if necessary )
14 changes: 7 additions & 7 deletions demos/bridge.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
Vec2,
Vector2,
Box,
DistanceConstraint,
Entity,
Expand Down Expand Up @@ -41,8 +41,8 @@ function createChain(x, y, w, h, number, spacing, pin1, pin2) {

for (var i = 1; i < number; i++) {
let chain = new Box(w, h)
let an1 = prev.setAnchor(new Vec2(w/2,0))
let an2 = prev.setAnchor(new Vec2(w/2,0))
let an1 = prev.setAnchor(new Vector2(w/2,0))
let an2 = prev.setAnchor(new Vector2(w/2,0))
let constraint = new DistanceConstraint(prev, chain, prev.getAnchor(an1),chain.getAnchor(an2))

bodies.push(
Expand All @@ -55,15 +55,15 @@ function createChain(x, y, w, h, number, spacing, pin1, pin2) {
prev = chain
}
if (pin1) {
let an1 = pin1.get("body").setAnchor(new Vec2(0,0))
let an2 = bodies[0].get("body").setAnchor(new Vec2(-w/2,0))
let an1 = pin1.get("body").setAnchor(new Vector2(0,0))
let an2 = bodies[0].get("body").setAnchor(new Vector2(-w/2,0))
let constraint = new DistanceConstraint(pin1.get("body"), bodies[0].get("body"), pin1.get("body").getAnchor(an1), bodies[0].get("body").getAnchor(an2))
constraints.push(constraint)
pin1.get("body").mask.group = 1
}
if (pin2) {
let an1 = pin2.get("body").setAnchor(new Vec2(0,0))
let an2 = bodies[bodies.length - 1].get("body").setAnchor(new Vec2(w/2,0))
let an1 = pin2.get("body").setAnchor(new Vector2(0,0))
let an2 = bodies[bodies.length - 1].get("body").setAnchor(new Vector2(w/2,0))
let constraint = new DistanceConstraint(pin2.get("body"), bodies[bodies.length - 1].get("body"), pin2.get("body").getAnchor(an1), bodies[bodies.length - 1].get("body").getAnchor(an2))
constraints.push(constraint)
pin2.get("body").mask.group = 1
Expand Down
6 changes: 3 additions & 3 deletions demos/car.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
Vec2,
Vector2,
DistanceConstraint,
Entity,
Box,
Expand Down Expand Up @@ -27,8 +27,8 @@ function createCar(x, y, tireSize = 20, maskgroup = 1, manager) {
let tirebody1 = new Ball(tireSize)
let tirebody2 = new Ball(tireSize)
let carbody = new Box(100, 50)
let an1 = carbody.setAnchor(new Vec2(30,25))
let an2 = carbody.setAnchor(new Vec2(-30,25))
let an1 = carbody.setAnchor(new Vector2(30,25))
let an2 = carbody.setAnchor(new Vector2(-30,25))
let constraint1 = new DistanceConstraint(carbody, tirebody1,carbody.getAnchor(an1))
let constraint2 = new DistanceConstraint(carbody, tirebody2,carbody.getAnchor(an2))
let carCompositeBody = new Composite()
Expand Down
6 changes: 3 additions & 3 deletions demos/constraints.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
Vec2,
Vector2,
Entity,
Box,
BodySprite,
Expand All @@ -20,8 +20,8 @@ export function constraint(manager) {
box2.attach("body", body2)
.attach("sprite", new BodySprite())

let an1 = body1.setAnchor(new Vec2(25,-25))
let an2 = body2.setAnchor(new Vec2(-25,-25))
let an1 = body1.setAnchor(new Vector2(25,-25))
let an2 = body2.setAnchor(new Vector2(-25,-25))

let constraint1 = new DistanceConstraint(body1,body2,body1.getAnchor(an1),body2.getAnchor(an2))

Expand Down
10 changes: 5 additions & 5 deletions demos/marterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
BasicMaterial,
StaticImageMaterial,
SpriteMaterial,
Vec2,
Vector2,
Entity
} from "/src/index.js"
const assets = {
Expand All @@ -15,10 +15,10 @@ const assets = {
export function materials(manager) {
manager.clear()
let geometry = new BufferGeometry([
new Vec2(-50, -50),
new Vec2(-50, 50),
new Vec2(50, 50),
new Vec2(50, -50)
new Vector2(-50, -50),
new Vector2(-50, 50),
new Vector2(50, 50),
new Vector2(50, -50)
])

//Basic material
Expand Down
12 changes: 6 additions & 6 deletions demos/pathfollower.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
PathFollowing,
WanderBehaviour,
Path,
Vec2
Vector2
} from "/src/index.js"

export function pathfollower(manager) {
Expand All @@ -30,11 +30,11 @@ export function pathfollower(manager) {

manager.add(a)

p.add(new Vec2(100,50))
p.add(new Vec2(300,100))
p.add(new Vec2(300,400))
p.add(new Vec2(200,400))
p.add(new Vec2(100,350))
p.add(new Vector2(100,50))
p.add(new Vector2(300,100))
p.add(new Vector2(300,400))
p.add(new Vector2(200,400))
p.add(new Vector2(100,350))

p.loop = true
}
2 changes: 1 addition & 1 deletion demos/seeker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
AgentSprite,
SeekBehaviour,
EvadeBehaviour,
Vec2,
Vector2,
Box,
rand
} from "/src/index.js"
Expand Down
2 changes: 1 addition & 1 deletion demos/wanderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
BodySprite,
AgentSprite,
WanderBehaviour,
Vec2,
Vector2,
Box,
rand
} from "/src/index.js"
Expand Down
Loading

0 comments on commit 2b5ff6d

Please sign in to comment.