Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from PainsPerdus/testing
First milestone!
- Loading branch information
Showing
52 changed files
with
2,887 additions
and
526 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "GBDefs"] | ||
path = GBDefs | ||
url = https://github.com/PainsPerdus/GBDefs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Collision Solver for Entities other than Isaac | ||
|
||
## Label | ||
|
||
`collisionSolverEntities` | ||
|
||
## Parameters | ||
|
||
| Label | Type | Size/Struct | Description | | ||
| ----- | ---- | ----------- | ----------- | | ||
| b | register | 1 byte | the 2 left bits tell whether the collision happens during (respectively) horizontal or vertical movement | | ||
| hl | register | 2 bytes | address to the caracter's sheet of the element | | ||
| collisionSolver_.collidingEntity | fixed address | element pointer | address to the element representing the entity | | ||
|
||
## Struct | ||
|
||
Description of the collisionSolver_var struct in the CollisionSolverEntities.var.s file | ||
|
||
| Label | Size/Struct | Description | | ||
| ----- | ----------- | ----------- | | ||
| collidingEntity | element pointer | address to the element representing the entity | | ||
|
||
## Return | ||
|
||
None | ||
|
||
## Pseudo Code | ||
|
||
~~~C | ||
// a function for when an entity collides with any element | ||
char void solve_collision_to_Isaac ( | ||
char touched_from, // b register | ||
element.sheet* s, // hl register | ||
element entity) { // collisionSolver_.collidingEntitty | ||
|
||
if (0b00010000 and s.size) // is the element blocking | ||
if (touched_from and 0b10000000) //Entity touches during horizontal movement | ||
Entity.x = Entity.x - ((Entity.speed and 0b11110000)/16) | ||
if (touched_from and 0b01000000) //Entity touches during vertical movement | ||
Entity.y = Entity.y - (Entity.speed and 0b00001111) | ||
|
||
} | ||
~~~ | ||
## Note | ||
Same function as for Isaac, but with less cases here (other entities donc take contact damages, and can't activate anything. | ||
For now, the informations given in the b register is not used in the actual implementation, as the collision function isn't able to detect direction of the impact. The code simply reverse the movement. | ||
## TODO | ||
* the rollback technique to manage collision with blocking elements is likely not to be the best, as it can cause lines of uncrossable pixels between Isaac and the element. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Collision Solver for Isaac | ||
|
||
## Label | ||
|
||
`collisionSolverIsaac` | ||
|
||
## Parameters | ||
|
||
| Label | Type | Size/Struct | Description | | ||
| ----- | ---- | ----------- | ----------- | | ||
| b | register | 1 byte | the 2 left bits tell whether the collision happens during (respectively) horizontal or vertical movement | | ||
| hl | register | 2 bytes | address to the caracter's sheet of the element | | ||
|
||
## Return | ||
|
||
None | ||
|
||
## Pseudo Code | ||
|
||
~~~C | ||
// a function for when Isaac collides with any element | ||
char void solve_collision_to_Isaac ( | ||
char touched_from, // b register | ||
element.sheet* s) { // hl register | ||
|
||
if (0b10000000 and s.size) // is the element blocking | ||
if (touched_from and 0b10000000) //Isaac touches during horizontal movement | ||
Isaac.x = Isaac.x - ((Isaac.speed and 0b11110000)/16) | ||
if (touched_from and 0b01000000) //Isaac touches during vertical movement | ||
Isaac.y = Isaac.y - (Isaac.speed and 0b00001111) | ||
|
||
/* if (0b01000000 and s.size) // does the element hurt Isaac | ||
if (Isaac.recover == 0) | ||
Isaac.hp = Isaac.hp - s.dmg; | ||
Isaac.recover = RECOVERYTIME; | ||
|
||
if (0b00100000 and s.size) // does the element react to Isaac's touch | ||
s.function(); | ||
*/ | ||
} | ||
~~~ | ||
## Note | ||
We mustn't forget to decrease the recover counter at each VBLank call. | ||
For now, the informations given in the b register is not used in the actual implementation, as the collision function isn't able to detect direction of the impact. The code simply reverse the movement. | ||
## TODO | ||
* the rollback technique to manage collision with blocking elements is likely not to be the best, as it can cause lines of uncrossable pixels between Isaac and the element. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# Input checker | ||
|
||
## Main include | ||
|
||
This code updates the values of Isaac regarding the states of the buttons. | ||
|
||
### file to include: | ||
|
||
`check_inputs.s` | ||
|
||
### Parameters: | ||
|
||
### Return: | ||
|
||
|
||
### Modified values: | ||
|
||
| Label | Type | Size/Struc | | ||
| ------------- | ------------- | ---------- | | ||
| a | register | 1 byte | | ||
| b | register | 1 byte | | ||
| c | register | 1 byte | | ||
| hl | register | 2 bytes | | ||
| global_.isaac.speed | fixed address | 1 byte | | ||
| global_.isaac.direction | fixed address | 1 byte | ||
| global_.isaac.tears | fixed address | 1 byte | | ||
|
||
### Global variables used | ||
|
||
| Label | Size | Description | | ||
| ------------- | ---------- | ----------- | | ||
| global_.isaac.speed | 1 byte | Isaac speed (split in 2 x 4bits, x speed and y speed. [7:4]: x speed, [3:0]: y speed) | | ||
| global_.isaac.direction | 1 byte | 2 bits indicate Isaac's direction (11 = up, 00 = down, 01 = right, 10 = left) (pos 1:0), 6 other bits are free | | ||
| global_.isaac.tears | 1 byte | 3 bits for horizontal speed of tears (pos 5:3), 3 bits for vertical speed (pos 2:0), 1 flag for "A was pressed the frame before" in postion (pos 7), 1 flag for "B was pressed" (pos 6)| | ||
|
||
### Global structs used | ||
|
||
|
||
#### Isaac | ||
|
||
Content of the struct "isaac" : | ||
|
||
| Label | Size/Struct | Description | | ||
| ----- | ---- | ----------- | | ||
| x | 1 byte | abscissa of Isaac | | ||
| y | 1 byte | ordinate of Isaac | | ||
| hp | 1 byte | health point of Isaac | | ||
| dmg | 1 byte | damage dealt by Isaac | | ||
| upgrades | 2 bytes | upgrades earned by Isaac (flags, to be defined) | | ||
| range | 1 byte | 7 bits for range of Isaac's tears (pos 6:0), 1 flag that tells if a tear was shot during the previous image (pos 7)| | ||
| speed | 1 byte | Isaac speed (split in 2 x 4bits, x speed (pos 7:4) and y speed (pos 3:0)) | | ||
| tears | 1 byte | 3 bits for horizontal speed of tears (pos 5:3), 3 bits for vertical speed (pos 2:0), 1 flag for "A was pressed the frame before" in postion (pos 7), 1 flag for "B was pressed" (pos 6)| | ||
| recover | 1 byte | recovery time | | ||
| bombs | 1 byte | number of bombs Isaac has | | ||
| direction | 1 byte | 2 bits indicate Isaac's direction (11 = up, 00 = down, 01 = right, 10 = left) (pos 1:0), 6 other bits are free | | ||
|
||
|
||
### Reserved memory: | ||
|
||
|
||
### Pseudo code | ||
|
||
~~~C | ||
// INIT ARROW | ||
(0xFFEE) = %00100000; // select the arrow keys | ||
b = get_arrow_values(); | ||
// CHECK ARROWS | ||
// speed_x = a[7:4], speed_y = a [3:0] | ||
// global_.isaac.direction = c[1:0] | ||
speed_x = 0; | ||
speed_y = 0; | ||
// direction = %11; --//By default, isaac looks at YOU!-- | ||
// Isaac no retains its position | ||
if (down_arrow(b)){ | ||
speed_y = 1; | ||
direction = %11; | ||
}else if (up_arrow(b)){ | ||
speed_x = -1; | ||
direction = %00; | ||
} | ||
if (right_arrow(b)){ | ||
speed_x = 1; | ||
direction = %01; | ||
}else if (left_arrow(b)){ | ||
speed_x = -1; | ||
direction = %10; | ||
} | ||
global_.isaac.speed = [speed_x, speed_y]; | ||
global_.isaac.direction = [global_.isaac.direction[7:3],direction] | ||
|
||
// INIT AB | ||
(0xFFEE) = %00010000; // select button keys | ||
b = get_button_values(); | ||
// SET AB | ||
if (A(b)) // bit $0,b | ||
set(global_.isaac.tears.a); | ||
else | ||
res(global_.isaac.tears.a); | ||
if (B(b)) // bit $0,a | ||
set(global_.isaac.tears.b); | ||
else | ||
res(global_.isaac.tears.b); | ||
|
||
~~~ | ||
* INIT ARROW: Set $FF00 to select the arrow keys. | ||
* CHECK ARROWS: Set the speed and direction according to the key pressed. | ||
* INIT AB: Set $FF00 to select the button keys. | ||
* CHECK AB: Set the a/b flags according to the key pressed. | ||
### Notes | ||
### TODO | ||
* In a future version, we will have to set the direction value too. | ||
* Set the seep to other value when the speed upgrade is set. |
Oops, something went wrong.