[Added] Jellies, healthpacks, ammopacks, powerups, [Updated] Gun rotation

This commit is contained in:
Ninjaws
2024-12-15 20:14:57 +01:00
parent de958b02e6
commit 5af531a08b
15 changed files with 564 additions and 155 deletions
+50
View File
@@ -0,0 +1,50 @@
#ifndef JELLY_H
#define JELLY_H
#include "raylib.h"
#include "services/MapService.h"
#include "services/AssetService.h"
#include "entities/TextureWrapper.h"
class Jelly
{
public:
Jelly(){
this->texture = TextureWrapper(AssetService::getInstance().getSprite(ESprite::JELLY),{32,32});
AssetService::getInstance().playSound(ESound::JELLY_FREED);
}
Jelly(Vector2 startPos)
{
this->startPosition = startPos;
this->texture = TextureWrapper(AssetService::getInstance().getSprite(ESprite::JELLY),{32,32},startPos);
AssetService::getInstance().playSound(ESound::JELLY_FREED);
}
void logic()
{
if (texture.getPosition().y >= startPosition.y)
{
velocity.y = -jumpSpeed;
}
else
{
velocity.y += gravity;
}
texture.move(velocity);
}
void draw()
{
DrawTexture(texture.getTexture(), texture.getPosition().x, texture.getPosition().y, WHITE);
}
private:
TextureWrapper texture;
float jumpSpeed = 7.0f;
float gravity = 0.6f;
Vector2 velocity = {0, 0};
Vector2 startPosition = {0,0};
};
#endif