Cant figure out collision error
2 posters
Page 1 of 1
Cant figure out collision error
Hey, I just finished episode 11 and before I get any further I'm trying to figure out why my collision is acting weird.
The bullets are getting stuck on the player and not disappearing.
Here's my code
http://pastebin.com/xQhHJRA5
And what the error looks like
https://i.servimg.com/u/f35/19/49/58/20/collis10.png
I tried comparing with the final solution, but I didn't see what the issue was
The bullets are getting stuck on the player and not disappearing.
Here's my code
http://pastebin.com/xQhHJRA5
And what the error looks like
https://i.servimg.com/u/f35/19/49/58/20/collis10.png
I tried comparing with the final solution, but I didn't see what the issue was
tribalzero- Posts : 3
Reputation : 0
Join date : 2016-06-13
Re: Cant figure out collision error
Two problems:
The major one is:
There is also
I used https://diffnow.com/ to compare code.
The major one is:
- Code:
socket.on('remove',function(data){
for(var i = 0 ; i < data.player.length; i++){
delete Player.list[data.player[i]];
}
for(var i = 0 ; i < data.bullet.length; i++){
delete Player.list[data.bullet[i]]; // <===== this should be Bullet.list
}
});
There is also
- Code:
socket.on('update',function(data){
for(var i = 0; i < data.player.length; i++){
var pack = data.player[i];
var p = Player.list[pack.id];
if(p){
if(pack.x !== undefined)
p.x = pack.x;
if(pack.y !== undefined)
p.y = pack.y;
if(pack.hp !== undefined)
p.hp = pack.hp;
if(pack.y !== undefined) //<==== should be pack.score
p.score = pack.score;
}
}
I used https://diffnow.com/ to compare code.
Re: Cant figure out collision error
awesome! good to know about that website, thanks
tribalzero- Posts : 3
Reputation : 0
Join date : 2016-06-13
Similar topics
» Websocket error when following multiplayer node tutorial "Client State"
» (Questions on tiled map editor) Does tiled require you to set a collision layer?
» (Questions on tiled map editor) Does tiled require you to set a collision layer?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|