fix: fix some bugs in prev commit
This commit is contained in:
		
							parent
							
								
									9aa1495dd0
								
							
						
					
					
						commit
						faeec383ba
					
				| 
						 | 
				
			
			@ -357,15 +357,17 @@ export default class RandomMapGenerator {
 | 
			
		|||
        if (old.sprites) {
 | 
			
		||||
            for (let index = 0; index < old.sprites.length; index++) {
 | 
			
		||||
                const sprite = old.sprites[index];
 | 
			
		||||
                if (sprite.type == 'player') {
 | 
			
		||||
                if (sprite.type === 'player') {
 | 
			
		||||
                    this.player.x = sprite.x;
 | 
			
		||||
                    this.player.y = sprite.y;
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    let tmp = new Enemy();
 | 
			
		||||
                    tmp.type = sprite.type;
 | 
			
		||||
                    tmp.position = new Vec2(posX + sprite.x, posY + sprite.y);
 | 
			
		||||
                    room.enemies.push(tmp);
 | 
			
		||||
                    if (this.gen.random() <= sprite.possibility) {
 | 
			
		||||
                        let tmp = new Enemy();
 | 
			
		||||
                        tmp.type = sprite.type;
 | 
			
		||||
                        tmp.position = new Vec2(posX + sprite.x, posY + sprite.y);
 | 
			
		||||
                        room.enemies.push(tmp);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user