icela / friceengine Goto Github PK
View Code? Open in Web Editor NEW:video_game: JVM game engine based on Swing/JavaFX.
Home Page: https://icela.github.io/#getting-started
License: GNU Affero General Public License v3.0
:video_game: JVM game engine based on Swing/JavaFX.
Home Page: https://icela.github.io/#getting-started
License: GNU Affero General Public License v3.0
The old implementation is ^3, not ^2.
Big bug.
源自: https://www.zhihu.com/question/263855824/answer/274659265 下的讨论
如果第一步想做到把官方演示代码用到的接口中文化(原有英文接口保留), 请问有何推荐方式? 在下Kotlin盲. 能有commit演示就更感谢了.
At least 5 demos should be up-to-date.
Because ImageResource.part
Instead of implementing pixel-level collision detection (#9 ), I personally recommand to provide a standalone collision box.
brighter()
java.awt.Color
If I use the new way of collision detection, I'll have to refactor the demos.
Old API: addCollider(obj, callBack)
New API: setCollider(callBack)
This should be a function of Game
or GameFx
, not standalone.
Old API will be deleted. Please mention.
不懂Kotlin,跑test的时候出现了2个问题:一个是AudioManager.kt的13行和16行编译出错,提示说要在async后加(),加上后编译OK,是Kotlin版本问题???二是运行后抛出空指针异常,原因是Game.kt的404行中的panel为空,看panel是在172行初始化的,debug发现压根就没执行这句话,啥情况???
The font objects are not reused. It's a kind of waste.
getScaledInstance
-> scale
getSubImage
-> part
The width
property is wrong in SimpleText
.
This should be fixed.
DirectedMove(targetX, targetY, speed)
ChasingMove(targetObj, speed)
Stupid mistake in AttachedObjects.
fun addObject(vararg objects: T) = objects.forEach { objs.remove(it) }
fun removeObject(vararg objects: T) = objects.forEach { objs.remove(it) }
And provide APIs like runLater(millis, SideEffect { 淦 })
invisible objects will not be drawn on screen.
darker
and brighter
without invoking java.awt.Color
get
+ Red
/Blue
/Green
/Alpha
greyify
, redify
, bluify
and average
Old code:
if (o is PhysicalObject) bgg.rotate(o.rotate, o.x + o.width / 2, o.y + o.width / 2)
Bug.
To allow code reuse.
淦
Since launch
has a naming conflict.
It invokes events more than once.
Java already has a BitSet
class.
Because it's totally unnecessary.
There isn't a loop audio player.
Need one.
Actually it should be location attaching
.
To make an STG game, Frice Engine should support pixel-level collision detection.
This is the last task of milestone 1.7.0 .
package com.github.kircute_ect.ectrpg.gui;
import com.github.kircute_ect.ectrpg.resources.Resources;
import org.frice.game.Game;
import org.frice.game.obj.sub.ImageObject;
import org.frice.game.utils.time.FTimer;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
public final class Gameframe extends Game {
private FTimer timer;
@Override
public void onInit() {
super.onInit();
Resources.getAllConfigs().readConfig();
Resources.replenishConfig();
switch (Resources.getAllConfigs().getConfig("GameOptions", "screen")) {
case 0:
this.setSize(new Dimension(608, 480));break;
case 1:
this.setSize(new Dimension(928, 736));break;
case 2:
this.setSize(new Dimension(1248, 928));break;
case 3:
//TODO full screen
break;
default:
this.setSize(new Dimension(608, 480));
}
}
@Override
public void onExit() {
super.onExit();
}
@Override
public void onRefresh() {
super.onRefresh();
if(timer.ended()) {
if(Resources.getPlayer().getDoor() != 0) {
if(Resources.getPlayer().getDoor() < 0) {
if(Resources.getPlayer().getDoor() == -20) {
Resources.getPlayer().inedDoor();
} else {
Resources.getPlayer().nextDoor();
}
} else if(Resources.getPlayer().getDoor() > 0) {
Resources.getPlayer().nextDoor();
}
}
if(Resources.getPlayer().getDoor() == -20) {
Resources.getPlayer().teleported();
Resources.getPlayer().setTeleport(null);
}
//TODO Game Refresh
int startpoint[] = {0,0};
float upBorderDistance = Resources.getPlayer().getLocation()[1];
float downBorderDistance = Resources.getPlayerMap().getMapHeight() - Resources.getPlayer().getLocation()[1];
float leftBorderDistance = Resources.getPlayer().getLocation()[2];
float rightBorderDistance = Resources.getPlayerMap().getMapWidth() - Resources.getPlayer().getLocation()[2];
int cameraMovingMinHeight = this.getHeight() / 32;
int cameraMovingMinWidth = this.getWidth() / 32;
boolean dontMovingUp = ( upBorderDistance <= cameraMovingMinHeight );
boolean dontMovingDown = ( downBorderDistance <= cameraMovingMinHeight );
boolean dontMovingLeft = ( leftBorderDistance <= cameraMovingMinWidth );
boolean dontMovingRight = ( rightBorderDistance <= cameraMovingMinWidth );
boolean lockUpDown = ( dontMovingUp && dontMovingDown );
boolean lockLeftRight = ( dontMovingLeft && dontMovingRight );
boolean miniMap = ( lockUpDown && lockLeftRight );
if(miniMap) {
startpoint[0] = (this.getHeight() - Resources.getPlayerMap().getMapHeight() * 32) / 2;
startpoint[1] = (this.getWidth() - Resources.getPlayerMap().getMapWidth() * 32) / 2;
for(int width = 0; width < Resources.getPlayerMap().getMapWidth(); width++) {
for(int height = 0; height < Resources.getPlayerMap().getMapHeight(); height++) {
this.addObject(new ImageObject(Resources.getPlayerMap().getMapView()[height][width],(double)width * 32, (double)height * 32));
}
}
}
}
}
Should be like this:
obj.useCollisionOffset(top, bottom, left, right)
obj.useCollisionOffset(topBottom, leftRight)
obj.useCollisionOffset(allDirection)
Do you like what you see?
There're currently only drawXxx
APIs.
There can be some APIs like strokeXxx
.
JavaFX provides nice audio players.
Reference: https://stackoverflow.com/a/35162134/7083401
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.