Jump to content

coderontheroad

Members
  • Posts

    3
  • Joined

  • Last visited

coderontheroad's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. @b10b can you use more simple english please sorry I can't understand your last paragraph. I want to share my find location function maybe it helps to understand my current situation; locateEnemy(){ var targetLocation; var locationX; var locationY; var skin; switch(this.lastLocation){ case 0: this.lastLocation = 1; locationX = 112; skin = "enemy2"; break; case 1: this.lastLocation = 2; locationX = 146; skin = "enemy"; break; case 2: this.lastLocation = 3; locationX = 180; skin = "enemy"; break; case 3: this.lastLocation = 0; locationX = 78; skin = "enemy2"; break; } locationY = (Math.random()*400) - 420; while(this.checkEnemyOverlap(locationX, locationY, this.enemies)){ locationY = (Math.random() * 400) - 420; } return [locationX, locationY, skin]; } locationX represents to which line, and there is while loop to check is there overlap with any other enemy car. Don't forget the lines moves different speed so I can't trust to locate perfectly at first position. Because of speed is different first position becomes doesn't matter. So if could you be more specific on how to modify locationY than maybe I can understand more easily. Sorry again to bother you more, but I really trying to understand
  2. @b10b thanks for your answer. I am trying to upload the image to the forum but always gives an error Here is the problem image https://prnt.sc/p8dsob There are 6 blue cars and 1 red car in total. And let's think lines like from left to right 1 to 4. The red car has a "speed" variable, and 1 line goes with speed*1.5... 2 line goes with speed*1.7... 3 line speed/1.5... 4 line speed/1.3.. I am adding cars one by one to each line. For example if the car added to 1 line the next car will be added to 2 line and it goes on order. Fixed data set can be easiest solution, but if I can solve in another way I prefer it I checked "procedural-generation approach " and "heuristic approach" keywords in Google but can't find similar examples, can you help more to understand them? Thanks
  3. Hey, I am new in game development and trying to develop my first games with Phaser. I am building something like old-style racing game. Think like you are the red car and blue cars are enemies. Right 2 line goes slower because of the same direction as you and left 2 line goes faster because of the opposite direction as you. I have a total of 8 number cars and placing them above the screen randomly when they go down the screen. The problem is, sometimes randomly you are in the situation like the image with there is no way out. Do you have any theoretical idea how can I fix it? This is a good challenge but I can't think anything useful yet https://prnt.sc/p8dsob
×
×
  • Create New...