# Obstacle | Raspberry Rocketeer Docs
Documentation for Raspberry Rocketeer Docs

# Class Obstacle

Obstacle of the game. Built from 2 pipes, one at the bottom, one at the top.

#### Hierarchy

- Entity
  - Obstacle

#### Implements

- Collidable

- Defined in Obstacle.ts:4

#####
Index

### Constructors

constructor

### Properties

padding
pipeBottom
pipeTop
speed
_distanceBetweenPipes
_startX

### Accessors

height
position
showHitbox
width
distanceBetweenPipes
startX

### Methods

collides
createPipes
draw
randomRange
randomizeHeight
resetPosition
update

## Constructors

### constructor

- new Obstacle(position: Position, obstacleWidth: number, obstacleHeight: number, pipeImagePath: string): Obstacle

- Constructs the Obstacle with the given image.

  #### Parameters

  - ##### position: Position

    starting position of the obstacle

  - ##### obstacleWidth: number

    width of the obstacle

  - ##### obstacleHeight: number

    height of the obstacle

  - ##### pipeImagePath: string

    path to the image to be used

  #### Returns Obstacle

  Overrides Entity.constructor

  - Defined in Obstacle.ts:28

## Properties

### `Private` `Readonly` padding

padding: number = 150

- Defined in Obstacle.ts:7

### `Private` pipeBottom

pipeBottom: Pipe

- Defined in Obstacle.ts:6

### `Private` pipeTop

pipeTop: Pipe

- Defined in Obstacle.ts:5

### `Private` `Readonly` speed

speed: number = 3

- Defined in Obstacle.ts:8

### `Static` `Private` _distanceBetweenPipes

_distanceBetweenPipes: number

- Defined in Obstacle.ts:10

### `Static` `Private` _startX

_startX: number

- Defined in Obstacle.ts:11

## Accessors

### height

- get height(): number

- Get height.

  #### Returns number

  Inherited from Entity.height

  - Defined in Entity.ts:70
- set height(value: number): void

- Set height.

  #### Parameters

  - ##### value: number

  #### Returns void

  Inherited from Entity.height

  - Defined in Entity.ts:78

### position

- get position(): Position

- Get position.

  #### Returns Position

  Inherited from Entity.position

  - Defined in Entity.ts:40
- set position(value: Position ): void

- Set position.

  #### Parameters

  - ##### value: Position

  #### Returns void

  Inherited from Entity.position

  - Defined in Entity.ts:48

### showHitbox

- get showHitbox(): boolean

- Get the hitbox's visibility.

  #### Returns boolean

  Inherited from Entity.showHitbox

  - Defined in Entity.ts:85
- set showHitbox(value: boolean): void

- Set the hitbox's visibility.

  #### Parameters

  - ##### value: boolean

  #### Returns void

  Inherited from Entity.showHitbox

  - Defined in Entity.ts:93

### width

- get width(): number

- Get width.

  #### Returns number

  Inherited from Entity.width

  - Defined in Entity.ts:55
- set width(value: number): void

- Set width.

  #### Parameters

  - ##### value: number

  #### Returns void

  Inherited from Entity.width

  - Defined in Entity.ts:63

### `Static` distanceBetweenPipes

- set distanceBetweenPipes(value: number): void

- #### Parameters

  - ##### value: number

  #### Returns void

  - Defined in Obstacle.ts:17

### `Static` startX

- set startX(value: number): void

- #### Parameters

  - ##### value: number

  #### Returns void

  - Defined in Obstacle.ts:13

## Methods

### collides

- collides(o: Entity ): boolean

- Determines when the obstacle is colliding with another entity

  #### Parameters

  - ##### o: Entity

    other entity

  #### Returns boolean

  Implementation of Collidable.collides

  - Defined in Obstacle.ts:89

### `Private` createPipes

- createPipes(position: Position, obstacleHeight: number, obstacleWidth: number, pipeImagePath: string): void
- `Private`

  Creates the pipes.

  #### Parameters

  - ##### position: Position

  - ##### obstacleHeight: number

  - ##### obstacleWidth: number

  - ##### pipeImagePath: string

  #### Returns void

  - Defined in Obstacle.ts:41

### draw

- draw(): void

- Draws the entity.

  #### Returns void

  Overrides Entity.draw

  - Defined in Obstacle.ts:80

### `Private` randomRange

- randomRange(min: number, max: number): number

- Creates a random number between the min and max parameter

  #### Parameters

  - ##### min: number

    minimum number

  - ##### max: number

    maximum number

  #### Returns number

  - Defined in Obstacle.ts:70

### randomizeHeight

- randomizeHeight(): void

- Randomizes the height of the pipes

  #### Returns void

  - Defined in Obstacle.ts:59

### resetPosition

- resetPosition(): void

- Resets the position of the obstacle to the Obstacle.startX variable Randomises the height of the pipes using the padding variable

  #### Returns void

  - Defined in Obstacle.ts:50

### update

- update(): void

- Updates the entity.

  #### Returns void

  Overrides Entity.update

  - Defined in Obstacle.ts:74

Generated using TypeDoc