source: 2017/24/EllaT/The Dinosaur/The Dinosaur/The_Dinosaur/The_Dinosaur.cs @ 8671

Revision 8671, 1.5 KB checked in by npo17_26, 2 years ago (diff)
Line 
1using System;
2using System.Collections.Generic;
3using Jypeli;
4using Jypeli.Assets;
5using Jypeli.Controls;
6using Jypeli.Effects;
7using Jypeli.Widgets;
8
9public class The_Dinosaur : PhysicsGame
10{
11    //haosui hapsiu hapsui
12
13    PlatformCharacter dino;
14    Image dinokuva = LoadImage("DINOOOOOOO");
15    Image possukuva = LoadImage("se ilkee possuli");
16    public override void Begin()
17    {
18        // Moiiiiii
19
20        dino = new PlatformCharacter(215.0, 200.0);
21        dino.Image = dinokuva;
22        Add(dino);
23        dino.X = -500.0;
24        dino.Y = 0.0;
25
26        PhysicsObject sika = new PhysicsObject(150.0, 150.0);
27        sika.Image = possukuva;
28        Add(sika);
29        sika.X = 200.0;
30        sika.Y = -150.0;
31        sika.Oscillate(new Vector(1.0, 0.0), 500.0, 0.15);
32
33        Level.Background.Color = Color.SkyBlue;
34
35        PhysicsObject palikka = new PhysicsObject(700.0, 200.0);
36            Add(palikka);
37
38        Gravity = new Vector(0.0, -500.0);
39
40
41        Vector impulssi = new Vector(500.0, 0.0);
42        sika.Hit(impulssi);
43
44
45        Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Hyppää");
46        //Keyboard.Listen(Key.Right, ButtonState.Down);
47        //Keyboard.Listen(Key.Left, ButtonState.Down);
48       
49
50
51        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli");
52        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
53    }
54
55    void Hyppaa()
56    {
57        dino.ForceJump(150.0);
58
59    }
60}
61
Note: See TracBrowser for help on using the repository browser.