1 / 5

Plan for the course Today: Understand instance in Object oriented programming. System listener

4. Plan for the course Today: Understand instance in Object oriented programming. System listener Write a function Some syntaks. Plan. Handout on …. Instans. A class (symbol in the library) is like a rubber stamp. A class is the plan for building the instance

ifama
Download Presentation

Plan for the course Today: Understand instance in Object oriented programming. System listener

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 4 Plan for the course Today: Understand instance in Object oriented programming. System listener Write a function Some syntaks

  2. Plan • Handout on ….

  3. Instans • A class (symbol in the library) is like a rubber stamp. • A class is the plan for building the instance • The plan describe properties and the behaviour of the instance. • Properties is variable’s • Behaviours is function’s

  4. Ball • Make a circle to a symbol • To types of listeners System and InteractionaddEventListener(Event.ENTER_FRAME,addEventListener(KeyboardEvent.KEY_DOWN • Write this code in the symbol

  5. var xSpeed:int; • var ySpeed:int; • var acc:int; • xSpeed =Math.random()*10-5; • ySpeed = 0; • acc=1; • addEventListener(Event.ENTER_FRAME, go); • function go (e){ • moove(); • accel(); • chek(); • } • function moove(){ • this.x=this.x+xSpeed; • this.y=this.y+ySpeed; • } • function accel (){ • ySpeed=ySpeed+acc; • } • function chek(){ • if (this.y+this.height>400){ • ySpeed=ySpeed*-1; • ySpeed++; • } • if (this.x+this.width>550 || this.x<0) { • xSpeed=xSpeed*-1; • } • }

More Related