Skip to content

Instantly share code, notes, and snippets.

@Saafan
Saafan / Vector3.h
Last active November 4, 2021 09:05
Vector3 Class
#include <iostream>
struct Vector3
{
Vector3() = default;
Vector3(float x, float y, float z) : x(x), y(y), z(z) {}
float x, y, z;
Vector3 operator+(Vector3);
Vector3 operator-(Vector3);
Vec2 CharacterPoints[4];
void UpdateCollisionPoints()
{
//The 5s below is just a small buffer,
//Change them accordingly
CharacterPoints[0] = Vec2(posX - 5, posY - 5);
CharacterPoints[1] = Vec2(posX + character_Width + 5, posY - 5);
CharacterPoints[2] = Vec2(posX - 5, PosY + character_Height + 5);
CharacterPoints[3] = Vec2(posX + character_Width - 5, posY + chrachter_Height + 5);
bool firstTime = true;
class Vec2
{
public:
float x = 0.0f;
float y = 0.0f;
}
Vec2 coinPositions[10];
package Gamecontroller;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.ArrayList;
import engine.Game;
import engine.GameListener;
import exceptions.CannotAttackException;
if (!oppField.isEmpty())
for (int i = 0; i < oppField.size(); i++) {
Minion m = oppField.get(i);
if (!m.isDivine()) {
if (m.getCurrentHP() - 4 <= 0) {
oppField.remove(m);
i--;
}
else
m.setCurrentHP(m.getCurrentHP() - 4);
public void attack(Minion target) {
if(!target.isDivine())
target.setCurrentHP(target.currentHP - this.getAttack());
else
target.setDivine(false);
if(!isDivine())
setCurrentHP(currentHP - target.getAttack());
else
setDivine(false);
@Saafan
Saafan / main.cpp
Last active March 24, 2020 06:04
#include <iostream>
int main()
{
cout << "Hello World!!!" << endl;
cout << "This is added Now!" << endl;
}