source: 2017/31/JohannesL/dodh/dodh/dodh/dodh.cs @ 9324

Revision 9324, 1.4 KB checked in by npo17_87, 23 months ago (diff)

eleffantti aseet ja räjähdykset.

Line 
1using System;
2using System.Collections.Generic;
3using Jypeli;
4using Jypeli.Assets;
5using Jypeli.Controls;
6using Jypeli.Effects;
7using Jypeli.Widgets;
8
9public class dodh : PhysicsGame
10{
11    Image taustaKuva = LoadImage("Diamond-Grid-ipad-3-wallpaper-ipad-wallpaper-retina-display-wallpaper-the-new-ipad-wallpaper--1920x1080");
12    LaserGun pelaajan1Ase;
13
14    public override void Begin()
15    {
16
17        Level.Background.Image = taustaKuva;
18        Gravity = new Vector(0.0, -10.0);
19
20
21
22        PhysicsObject laser = new PhysicsObject(200, 200);
23        laser.Shape = Shape.Circle;
24        laser.Mass = 1.0;
25        laser.Color = Color.Green;
26        Level.CreateBorders();
27
28        Add(laser);
29
30        pelaajan1Ase = new LaserGun(100, 100);
31
32        pelaajan1Ase.ProjectileCollision = AmmusOsui;
33        laser.Add(pelaajan1Ase);
34
35
36        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
37        Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", pelaajan1Ase);
38
39    }
40    void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde)
41    {
42
43
44    }
45    void AmmuAseella(LaserGun ase)
46    {
47        PhysicsObject ammus = ase.Shoot();
48
49        if (ammus != null)
50        {
51            //ammus.Size *= 3;
52            //ammus.Image = ...
53            //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0);
54        }
55    }
56}
Note: See TracBrowser for help on using the repository browser.