Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
StraToN committed Feb 8, 2016
1 parent 7943660 commit e5c8309
Show file tree
Hide file tree
Showing 150 changed files with 269 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Assets/gui.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

extends Label

# member variables here, example:
# var a=2
# var b="textvar"

func _on_need_show(what):
set_text(what)

func _ready():
add_to_group("GUI")
pass


41 changes: 41 additions & 0 deletions Assets/object.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

extends Control

export var name = ""
# "walk_up", "walk_rightup", "walk_right", "walk_rightfront", "walk_front", "walk_leftfront", "walk_left", "walk_leftup"
export (String, "idle_up", "idle_rightup", "idle_rightfront", "idle_front", "idle_leftfront", "idle_leftup") var animation_arrived = "idle_rightfront"
export (String,FILE) var ScriptRes = ""

func get_interact_pos():
if has_node("interactpos"):
return get_node("interactpos").get_global_pos()
else:
return get_global_pos()


func on_mouse_enter():
if name == "":
name = "noname_" + get_name()
get_tree().call_group(0, "GUI", "_on_need_show", name)
#print(name)


func on_mouse_exit():
get_tree().call_group(0, "GUI", "_on_need_show", "")
#print("exit")


func _input_event(ev):
if ev.is_pressed() and ev.button_index == BUTTON_LEFT:
get_tree().call_group(0, "Movement", "_go_to_object", get_interact_pos(), animation_arrived)


func _ready():
add_to_group("Movement")
add_to_group("GUI")
connect("mouse_enter", self, "on_mouse_enter")
connect("mouse_exit", self, "on_mouse_exit")
connect("input_event", self, "_input_event")
pass


Empty file added Assets/objects/statue.obs
Empty file.
Binary file added Assets/rooms/desk/bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/rooms/desk/depth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/rooms/desk/depth.xcf
Binary file not shown.
Binary file added Assets/rooms/desk/desk.scn
Binary file not shown.
Binary file added Assets/rooms/lab/bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/rooms/lab/lab.scn
Binary file not shown.
Binary file added Assets/rooms/reggae/bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/guybrush.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/guybrush2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/00.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/sprites/MI3/png/20.png
Binary file added Assets/sprites/MI3/png/21.png
Binary file added Assets/sprites/MI3/png/22.png
Binary file added Assets/sprites/MI3/png/23.png
Binary file added Assets/sprites/MI3/png/24.png
Binary file added Assets/sprites/MI3/png/25.png
Binary file added Assets/sprites/MI3/png/26.png
Binary file added Assets/sprites/MI3/png/27.png
Binary file added Assets/sprites/MI3/png/28.png
Binary file added Assets/sprites/MI3/png/29.png
Binary file added Assets/sprites/MI3/png/30.png
Binary file added Assets/sprites/MI3/png/31.png
Binary file added Assets/sprites/MI3/png/32.png
Binary file added Assets/sprites/MI3/png/33.png
Binary file added Assets/sprites/MI3/png/34.png
Binary file added Assets/sprites/MI3/png/35.png
Binary file added Assets/sprites/MI3/png/36.png
Binary file added Assets/sprites/MI3/png/37.png
Binary file added Assets/sprites/MI3/png/38.png
Binary file added Assets/sprites/MI3/png/39.png
Binary file added Assets/sprites/MI3/png/40.png
Binary file added Assets/sprites/MI3/png/41.png
Binary file added Assets/sprites/MI3/png/42.png
Binary file added Assets/sprites/MI3/png/43.png
Binary file added Assets/sprites/MI3/png/44.png
Binary file added Assets/sprites/MI3/png/45.png
Binary file added Assets/sprites/MI3/png/46.png
Binary file added Assets/sprites/MI3/png/47.png
Binary file added Assets/sprites/MI3/png/48.png
Binary file added Assets/sprites/MI3/png/49.png
Binary file added Assets/sprites/MI3/png/50.png
Binary file added Assets/sprites/MI3/png/51.png
Binary file added Assets/sprites/MI3/png/52.png
Binary file added Assets/sprites/MI3/png/53.png
Binary file added Assets/sprites/MI3/png/54.png
Binary file added Assets/sprites/MI3/png/55.png
Binary file added Assets/sprites/MI3/png/56.png
Binary file added Assets/sprites/MI3/png/57.png
Binary file added Assets/sprites/MI3/png/58.png
Binary file added Assets/sprites/MI3/png/59.png
Binary file added Assets/sprites/MI3/png/60.png
Binary file added Assets/sprites/MI3/png/61.png
Binary file added Assets/sprites/MI3/png/62.png
Binary file added Assets/sprites/MI3/png/63.png
Binary file added Assets/sprites/MI3/png/64.png
Binary file added Assets/sprites/MI3/png/65.png
Binary file added Assets/sprites/MI3/xcf/00.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/01.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/02.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/03.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/04.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/05.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/06.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/08.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/09.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/10.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/11.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/12.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/13.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/14.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/15.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/16.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/17.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/18.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/19.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/20.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/21.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/22.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/23.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/24.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/25.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/26.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/27.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/28.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/29.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/30.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/31.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/32.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/33.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/34.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/35.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/36.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/37.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/38.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/39.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/40.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/41.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/42.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/43.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/44.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/45.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/46.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/47.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/48.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/49.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/50.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/51.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/52.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/53.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/54.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/55.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/56.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/57.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/58.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/59.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/60.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/61.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/62.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/63.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/64.xcf
Binary file not shown.
Binary file added Assets/sprites/MI3/xcf/65.xcf
Binary file not shown.
Binary file added Assets/sprites/guybrush.scn
Binary file not shown.
11 changes: 11 additions & 0 deletions Assets/sprites/player.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

extends KinematicBody2D

func interact(target):
pass

func _ready():
set_process(true)

func _process(delta):
pass
152 changes: 152 additions & 0 deletions Assets/sprites/scripts/CharacterClickMovement.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@

extends Navigation2D

export(NodePath) var playerPath
var player
var terrain

var begin=Vector2()
var end=Vector2()
var path=[]

var animation = "idle_rightfront"
var next_idle = "idle_rightfront"
var force_next_idle = ""

const DEFAULT_SPEED = 150.0
var speed = DEFAULT_SPEED



func _process(delta):
if (path.size()>1):
print(speed)
var to_walk = delta*speed

while(to_walk>0 and path.size()>=2):
var pfrom = path[path.size()-1]
var pto = path[path.size()-2]
var d = pfrom.distance_to(pto)

_update_speeddepth(pfrom, pto)
to_walk = delta*speed

var pVecFromTo = Vector2(pto.x - pfrom.x, pfrom.y - pto.y)
var angle = pVecFromTo.normalized().angle()

if (angle > -PI/8 || angle < PI/8):
animation = "walk_rightup"
next_idle = "idle_rightup"
if (angle > 3*PI/8 && angle < 5*PI/8):
animation = "walk_right"
next_idle = "idle_rightfront"
if (angle < PI/8 && angle >= -PI/8):
animation = "walk_up"
next_idle = "idle_up"
if (angle > 5*PI/8 && angle < 7*PI/8):
animation = "walk_rightfront"
next_idle = "idle_rightfront"
if (angle > 7*PI/8 || angle < -7*PI/8):
animation = "walk_front"
next_idle = "idle_front"
if (angle < -PI/8 && angle > -3*PI/8):
animation = "walk_leftup"
next_idle = "idle_leftup"
if (angle < -3*PI/8 && angle > -5*PI/8):
animation = "walk_left"
next_idle = "idle_leftfront"
if (angle < -5*PI/8 && angle > -7*PI/8):
animation = "walk_leftfront"
next_idle = "idle_leftfront"

# si aucune animation n'est en cours
if (not player.get_node("sprite/anim").is_playing()):
player.get_node("sprite/anim").play(animation)
else: # une animation est déjà en cours, on la remplace si celle qu'on veut jouer est différente
if (animation != player.get_node("sprite/anim").get_current_animation()):
player.get_node("sprite/anim").play(animation)

# waypoint atteint, on le supprime de la liste
if (d<=to_walk):
path.remove(path.size()-1)
to_walk-=d
else:
path[path.size()-1] = pfrom.linear_interpolate(pto,to_walk/d)
to_walk=0


# modifier position du sprite au temps T
var atpos = path[path.size()-1]
player.set_pos(atpos)

# rescale selon la profondeur donnée par le terrain
player.set_scale(terrain.get_scale(atpos))


if (path.size()<2):
path=[]
if player.get_node("sprite").is_flipped_h():
player.get_node("sprite").set_flip_h(false)

if force_next_idle != "":
player.get_node("sprite/anim").play(force_next_idle)
force_next_idle = ""
else:
player.get_node("sprite/anim").play(next_idle)

else:
set_process(false)




func _update_path():
var p = get_simple_path(begin,end,true)
path=Array(p) # Vector2array to complex to use, convert to regular array
path.invert()

set_process(true)


func _update_speeddepth(begin, end):
var vdif = terrain.get_scale_diff(begin, end)
if vdif < 0.1:
speed = 100.0
else:
speed = DEFAULT_SPEED

func _input(ev):
if (ev.type==InputEvent.MOUSE_BUTTON and ev.pressed and ev.button_index==BUTTON_LEFT):
# si clic sur un objet, alors destination = Position2d associée à cet objet
begin=player.get_pos()
#mouse to local navigation coords
end=ev.pos - get_pos()

_update_path()



func _go_to_object(pos, animation_arrived):
var ev = InputEvent()
ev.type = InputEvent.MOUSE_BUTTON
ev.pressed = true
ev.button_index = BUTTON_LEFT
ev.pos = pos
force_next_idle = animation_arrived
_input(ev)

func _ready():
# Initialization here
##var arrNodesInGrp = get_tree().get_nodes_in_group("Movement")
##for nodesGrp in arrNodesInGrp:
## if nodesGrp.get_name() == "player":
## player = nodesGrp
player = get_node(playerPath)

player.get_node("sprite/anim").set_current_animation("idle_right")

terrain = get_parent()

set_process_input(true)
pass

30 changes: 30 additions & 0 deletions Assets/terrain.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

extends Sprite


export(Image) var depthFile
export(float) var nearScale = 1.0
export(float) var farScale = 0.5
var originalScale = farScale + (nearScale-farScale)/2

func get_scale(pos):
var depthPx = depthFile.get_pixel(pos.x, pos.y)
return _get_scale_range(depthPx.gray())

func _get_scale_range(r):
var dr = farScale + (nearScale - farScale) * r
return Vector2(dr, dr)

func get_scale_diff(begin, end):
printt("BEGIN", begin, get_scale(begin))
printt("END", end, get_scale(end))
printt("DIFF", abs((get_scale(begin) - get_scale(end)).x) )
print()
return abs( (get_scale(begin) - get_scale(end)).x)

func _ready():
# Initialization here

pass


19 changes: 19 additions & 0 deletions engine.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[application]

name="AdventureGame"
main_scene="res://Assets/rooms/desk/desk.scn"
icon="icon.png"

[display]

width=1280
height=800

[image_loader]

filter=false
gen_mipmaps=false

[render]

mipmap_policy=2
Empty file added favorites.cfg
Empty file.
Binary file added icon.png
1 change: 1 addition & 0 deletions icon.png.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gen_mipmaps=false

0 comments on commit e5c8309

Please sign in to comment.