Computer Science I Share plans for virtual something. Text. Show my virtual dog. Classwork: Plans for your virtual something. Homework: start implementation.
Recap: Virtual Dog Show HTML JavaScript version Discrete event simulation – At fixed periods of time, things happen, including, maybe, changes of state. My dog loses weight – Player actions: Feed dog: weight increases. Time is stored Pet dog: probability varies based on time since last feeding. Note: always possible to be wagging or mean.
Your plans Virtual ? What are the player actions? What are the states? – Are there state variables? What are the calculation for transitions? – What information is required? – Any timing? – Anything stochastic?
Software development Design stage: what are you trying to do? Design stage in more detail – Form of player actions (aka affordances): buttons or clicking on screen or dragging or key or ??? Implementation – (choose language, other technology) – What are the functions, variables, classes? Program – test – debug/enhance – test Deploy
Note The JavaScript virtual dog was done in older version of html and JavaScript. – For example, no use of canvas. Just buttons. – BUT could handle animated gifs. For your Processing sketch, you may consider – Drawing pictures as well as image. Look up how to do Shape – Buttons using a Button class – Clicking somewhere on the screen to do something – ? This is a week project only, so save more complex ideas for your final project.
My Implementation High level implementation: – Use 4 buttons. Have currentdog variable to hold image of appropriate state. Have weight variable. – Use println, mainly for debugging. COULD WRITE ON SCREEN. – Use draw to make periodic decreasing weight & checking on weight for possible state change Keep dog in wagging or snarling state for set amount of time Define Button class – Methods: Button, isOver, display Functions – setup, draw, mouseClicked (checks for which button) – makeButtons, drawButtons – petdog, feeddog, checkdog Note checkdog code could be in draw.
Pop Quiz Find out how to use (create, declare, draw on screen) text using a specific font, specific size, color, and specific position on the screen. Write answer and Address of source(s)
Classwork / Homework Implementation plans for your virtual something. Work on virtual something.