Skip to content

Commit

Permalink
enemy sprites
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Heinen committed Apr 9, 2017
1 parent 6b6fe18 commit f615fec
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 3 deletions.
Binary file added Sprites/Monster/Cookiemonster.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 Sprites/Monster/Cookiemonster.xcf
Binary file not shown.
Binary file added Sprites/Monster/Hornmonster.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 Sprites/Monster/Hornmonster.xcf
Binary file not shown.
Binary file added Sprites/Monster/all.xcf
Binary file not shown.
Binary file added Sprites/Monster/all_monsters.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 enemy/all_monsters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions enemy/enemy.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ extents = Vector2( 9.9237, 9.89589 )

[sub_resource type="GDScript" id=2]

script/source = "#extends RigidBody2D\nvar WALK_ACCEL = 800.0\nvar WALK_DEACCEL = 800.0\nvar WALK_MAX_VELOCITY = 200.0\nvar damage = 10\nvar health = 100\n\nvar move_direction = Vector2(1,0)\n\nvar enemy_size\n\nvar direction = Vector2(1.0, 0.0) #right\n\nfunc _ready():\n\t# Called every time the node is added to the scene.\n\t# Initialization here\n\tenemy_size = get_node(\"enemy\").get_texture().get_size()\n\t\n\t\n\tset_fixed_process(true)\n\n\nfunc _integrate_forces(s):\n\t\n\trandomize()\n\tvar x = (randf() -0.5) * 50\n\tvar y = (randf() -0.5) * 50\n\t#print(s.get_contact_count())\n\t\n\tvar lv = s.get_linear_velocity()\n\tvar step = s.get_step()\n\t\n\tvar move_left = false\n\tvar move_right = false\n\tvar move_up = false\n\tvar move_down = false\n\t\n\t#var shoot = Input.is_action_pressed(\"shoot\")\n\n\tvar enemy_rect = Rect2( get_node(\"enemy\").get_pos() - enemy_size*0.5, enemy_size )\n\tvar enemy_pos = get_node(\"enemy\").get_pos()\n\t\n\tprint(lv)\n\t\n\tlv.x += x\n\tlv.y += y\n\t\t\t\n\ts.set_linear_velocity(lv)\n\n\nfunc _on_enemy_body_enter( body ):\n\t#body.\n\tprint(\"enemy coll\")\n\tpass # replace with function body\n\nfunc getDamage():\n\treturn damage"
script/source = "#extends RigidBody2D\nvar WALK_ACCEL = 800.0\nvar WALK_DEACCEL = 800.0\nvar WALK_MAX_VELOCITY = 200.0\nvar damage = 10\nvar health = 100\n\nvar move_direction = Vector2(1,0)\n\nvar enemy_size\n\nvar direction = Vector2(1.0, 0.0) #right\n\nvar monstertextures = load(\"res://enemy/all_monsters.png\")\nvar numberOfDifEnemys = 2\n\n\t\nfunc set_texture():\n\trandomize()\n\tvar nr = randi()% numberOfDifEnemys\n\tvar texture = AtlasTexture.new()\n\ttexture.set_atlas(monstertextures)\n\t#texture.set_region(Rect2(0,0,60,60))\n\ttexture.set_region(getTextureRect(nr))\n\tget_node(\"enemy\").set_texture(texture)\n\n\n\nfunc getTextureRect(nummer):\n\tvar x= nummer % numberOfDifEnemys * 60\n\tvar y = 0\n\treturn Rect2(x,y,60,60)\n\nfunc _ready():\n\t# Called every time the node is added to the scene.\n\t# Initialization here\n\tset_texture()\n\tenemy_size = get_node(\"enemy\").get_texture().get_size()\n\t\n\t\n\tset_fixed_process(true)\n\n\nfunc _integrate_forces(s):\n\t\n\trandomize()\n\tvar x = (randf() -0.5) * 50\n\tvar y = (randf() -0.5) * 50\n\t#print(s.get_contact_count())\n\t\n\tvar lv = s.get_linear_velocity()\n\tvar step = s.get_step()\n\t\n\tvar move_left = false\n\tvar move_right = false\n\tvar move_up = false\n\tvar move_down = false\n\t\n\t#var shoot = Input.is_action_pressed(\"shoot\")\n\n\tvar enemy_rect = Rect2( get_node(\"enemy\").get_pos() - enemy_size*0.5, enemy_size )\n\tvar enemy_pos = get_node(\"enemy\").get_pos()\n\t\n\tprint(lv)\n\t\n\tlv.x += x\n\tlv.y += y\n\t\t\t\n\ts.set_linear_velocity(lv)\n\n\nfunc _on_enemy_body_enter( body ):\n\t#body.\n\tprint(\"enemy coll\")\n\tpass # replace with function body\n\nfunc getDamage():\n\treturn damage"

[node name="enemy" type="RigidBody2D" groups=[ "enemy" ]]

transform/pos = Vector2( -0.135885, 0 )
transform/scale = Vector2( 0.995754, 1 )
transform/scale = Vector2( 0.8, 0.8 )
input/pickable = false
shapes/0/shape = SubResource( 1 )
shapes/0/transform = Matrix32( 2.83209, 0, 0, 2.49955, -3.11282, 0.396297 )
Expand All @@ -41,7 +41,6 @@ script/script = SubResource( 2 )
[node name="enemy" type="Sprite" parent="."]

transform/pos = Vector2( -2.95717, 0.300346 )
transform/scale = Vector2( 1.74732, 1.54373 )
texture = ExtResource( 1 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
Expand Down

0 comments on commit f615fec

Please sign in to comment.