Merge branch 'master' of https://github.com/okamstudio/godot
|
@ -21,3 +21,7 @@
|
|||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
**********************************************************************
|
||||
|
||||
|
|
|
@ -67,12 +67,16 @@ env_base.android_source_modules=[]
|
|||
env_base.android_source_files=[]
|
||||
env_base.android_module_libraries=[]
|
||||
env_base.android_manifest_chunk=""
|
||||
env_base.android_permission_chunk=""
|
||||
env_base.android_appattributes_chunk=""
|
||||
env_base.disabled_modules=[]
|
||||
|
||||
env_base.__class__.android_module_source = methods.android_module_source
|
||||
env_base.__class__.android_module_library = methods.android_module_library
|
||||
env_base.__class__.android_module_file = methods.android_module_file
|
||||
env_base.__class__.android_module_manifest = methods.android_module_manifest
|
||||
env_base.__class__.android_module_permission = methods.android_module_permission
|
||||
env_base.__class__.android_module_attribute = methods.android_module_attribute
|
||||
env_base.__class__.disable_module = methods.disable_module
|
||||
|
||||
env_base.__class__.add_source_files = methods.add_source_files
|
||||
|
|
|
@ -1778,6 +1778,11 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
|
|||
f->store_32(VERSION_MINOR);
|
||||
f->store_32(FORMAT_VERSION);
|
||||
|
||||
if (f->get_error()!=OK && f->get_error()!=ERR_FILE_EOF) {
|
||||
f->close();
|
||||
return ERR_CANT_CREATE;
|
||||
}
|
||||
|
||||
//f->store_32(saved_resources.size()+external_resources.size()); // load steps -not needed
|
||||
save_unicode_string(p_resource->get_type());
|
||||
uint64_t md_at = f->get_pos();
|
||||
|
@ -1910,6 +1915,11 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
|
|||
|
||||
f->store_buffer((const uint8_t*)"RSRC",4); //magic at end
|
||||
|
||||
if (f->get_error()!=OK && f->get_error()!=ERR_FILE_EOF) {
|
||||
f->close();
|
||||
return ERR_CANT_CREATE;
|
||||
}
|
||||
|
||||
f->close();
|
||||
|
||||
|
||||
|
|
|
@ -2592,6 +2592,11 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res
|
|||
}
|
||||
|
||||
exit_tag("resource_file");
|
||||
if (f->get_error()!=OK && f->get_error()!=ERR_FILE_EOF) {
|
||||
f->close();
|
||||
return ERR_CANT_CREATE;
|
||||
}
|
||||
|
||||
f->close();
|
||||
//memdelete(f);
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ void CameraMatrix::set_orthogonal(float p_size, float p_aspect, float p_znear, f
|
|||
|
||||
|
||||
void CameraMatrix::set_frustum(float p_left, float p_right, float p_bottom, float p_top, float p_near, float p_far) {
|
||||
|
||||
#if 0
|
||||
///@TODO, give a check to this. I'm not sure if it's working.
|
||||
set_identity();
|
||||
|
||||
|
@ -133,10 +133,27 @@ void CameraMatrix::set_frustum(float p_left, float p_right, float p_bottom, floa
|
|||
matrix[2][3]=-(2*p_far*p_near) / (p_far-p_near);
|
||||
matrix[3][2]=-1;
|
||||
matrix[3][3]=0;
|
||||
#else
|
||||
float *te = &matrix[0][0];
|
||||
float x = 2 * p_near / ( p_right - p_left );
|
||||
float y = 2 * p_near / ( p_top - p_bottom );
|
||||
|
||||
float a = ( p_right + p_left ) / ( p_right - p_left );
|
||||
float b = ( p_top + p_bottom ) / ( p_top - p_bottom );
|
||||
float c = - ( p_far + p_near ) / ( p_far - p_near );
|
||||
float d = - 2 * p_far * p_near / ( p_far - p_near );
|
||||
|
||||
te[0] = x; te[4] = 0; te[8] = a; te[12] = 0;
|
||||
te[1] = 0; te[5] = y; te[9] = b; te[13] = 0;
|
||||
te[2] = 0; te[6] = 0; te[10] = c; te[14] = d;
|
||||
te[3] = 0; te[7] = 0; te[11] = - 1; te[15] = 0;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
float CameraMatrix::get_z_far() const {
|
||||
|
||||
const float * matrix = (const float*)this->matrix;
|
||||
|
|
|
@ -1033,6 +1033,13 @@ void Object::add_user_signal(const MethodInfo& p_signal) {
|
|||
signal_map[p_signal.name]=s;
|
||||
}
|
||||
|
||||
bool Object::_has_user_signal(const StringName& p_name) const {
|
||||
|
||||
if (!signal_map.has(p_name))
|
||||
return false;
|
||||
return signal_map[p_name].user.name.length()>0;
|
||||
}
|
||||
|
||||
struct _ObjectSignalDisconnectData {
|
||||
|
||||
StringName signal;
|
||||
|
@ -1431,6 +1438,7 @@ void Object::_bind_methods() {
|
|||
// ObjectTypeDB::bind_method(_MD("call_deferred","method","arg1","arg2","arg3","arg4"),&Object::_call_deferred_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()));
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("add_user_signal","signal","arguments"),&Object::_add_user_signal,DEFVAL(Array()));
|
||||
ObjectTypeDB::bind_method(_MD("has_user_signal","signal"),&Object::_has_user_signal);
|
||||
// ObjectTypeDB::bind_method(_MD("emit_signal","signal","arguments"),&Object::_emit_signal,DEFVAL(Array()));
|
||||
|
||||
|
||||
|
|
|
@ -386,6 +386,7 @@ friend void postinitialize_handler(Object*);
|
|||
Dictionary metadata;
|
||||
|
||||
void _add_user_signal(const String& p_name, const Array& p_pargs=Array());
|
||||
bool _has_user_signal(const StringName& p_name) const;
|
||||
Variant _emit_signal(const Variant** p_args, int p_argcount, Variant::CallError& r_error);
|
||||
Array _get_signal_list() const;
|
||||
Array _get_signal_connection_list(const String& p_signal) const;
|
||||
|
|
|
@ -552,6 +552,9 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
|
|||
if (p_b.type==MATRIX32) {
|
||||
_RETURN( *p_a._data._matrix32 * *p_b._data._matrix32 );
|
||||
};
|
||||
if (p_b.type==VECTOR2) {
|
||||
_RETURN( p_a._data._matrix32->xform( *(const Vector2*)p_b._data._mem) );
|
||||
};
|
||||
r_valid=false;
|
||||
return;
|
||||
} break;
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
|
||||
extends KinematicBody2D
|
||||
|
||||
# member variables here, example:
|
||||
# var a=2
|
||||
# var b="textvar"
|
||||
|
||||
const MAX_SPEED = 300.0
|
||||
const IDLE_SPEED = 10.0
|
||||
const ACCEL=5.0
|
||||
const VSCALE=0.5
|
||||
const SHOOT_INTERVAL=0.3
|
||||
|
||||
var speed=Vector2()
|
||||
var current_anim=""
|
||||
var current_mirror=false
|
||||
|
||||
var shoot_countdown=0
|
||||
|
||||
func _input(ev):
|
||||
if (ev.type==InputEvent.MOUSE_BUTTON and ev.button_index==1 and ev.pressed and shoot_countdown<=0):
|
||||
var pos = get_canvas_transform().affine_inverse() * ev.pos
|
||||
var dir = (pos-get_global_pos()).normalized()
|
||||
var bullet = preload("res://shoot.scn").instance()
|
||||
bullet.advance_dir=dir
|
||||
bullet.set_pos( get_global_pos() + dir * 60 )
|
||||
get_parent().add_child(bullet)
|
||||
shoot_countdown=SHOOT_INTERVAL
|
||||
|
||||
|
||||
|
||||
|
||||
func _fixed_process(delta):
|
||||
|
||||
shoot_countdown-=delta
|
||||
var dir = Vector2()
|
||||
if (Input.is_action_pressed("up")):
|
||||
dir+=Vector2(0,-1)
|
||||
if (Input.is_action_pressed("down")):
|
||||
dir+=Vector2(0,1)
|
||||
if (Input.is_action_pressed("left")):
|
||||
dir+=Vector2(-1,0)
|
||||
if (Input.is_action_pressed("right")):
|
||||
dir+=Vector2(1,0)
|
||||
|
||||
if (dir!=Vector2()):
|
||||
dir=dir.normalized()
|
||||
speed = speed.linear_interpolate(dir*MAX_SPEED,delta*ACCEL)
|
||||
var motion = speed * delta
|
||||
motion.y*=VSCALE
|
||||
motion=move(motion)
|
||||
|
||||
if (is_colliding()):
|
||||
var n = get_collision_normal()
|
||||
motion=n.slide(motion)
|
||||
move(motion)
|
||||
|
||||
var next_anim=""
|
||||
var next_mirror=false
|
||||
|
||||
if (dir==Vector2() and speed.length()<IDLE_SPEED):
|
||||
next_anim="idle"
|
||||
next_mirror=false
|
||||
elif (speed.length()>IDLE_SPEED*0.1):
|
||||
var angle = atan2(abs(speed.x),speed.y)
|
||||
|
||||
next_mirror = speed.x>0
|
||||
if (angle<PI/8):
|
||||
next_anim="bottom"
|
||||
next_mirror=false
|
||||
elif (angle<PI/4+PI/8):
|
||||
next_anim="bottom_left"
|
||||
elif (angle<PI*2/4+PI/8):
|
||||
next_anim="left"
|
||||
elif (angle<PI*3/4+PI/8):
|
||||
next_anim="top_left"
|
||||
else:
|
||||
next_anim="top"
|
||||
next_mirror=false
|
||||
|
||||
|
||||
if (next_anim!=current_anim or next_mirror!=current_mirror):
|
||||
get_node("frames").set_flip_h(next_mirror)
|
||||
get_node("anim").play(next_anim)
|
||||
current_anim=next_anim
|
||||
current_mirror=next_mirror
|
||||
|
||||
|
||||
|
||||
func _ready():
|
||||
# Initialization here
|
||||
set_fixed_process(true)
|
||||
set_process_input(true)
|
||||
pass
|
||||
|
||||
|
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 8.5 KiB |