Are there any limitations for the MP3 in terms of bitrate or length?
Two limitations come to mind:
- length, since it all has to fit in flash. It’s for sound effects, not for full songs.
- format actually depends on the browser. Firefox supports wav, ogg and mp3. Chrome supports wav and mp3, iirc. Bitrate should not be an issue.
Thanks for the reply… I guess I would need to use the SD card for music. (which is not yet implemented in the online editor I assume)
So I have tried to make also something in the online editor. I would like to post it here but I have no clue how to make a gif of the gameplay. How did you guys do this with the online editor?
Here is my entry. It is a little minigame:
You have to defend your planet against aliens by shooting ufos. There are three types of ufos: a big one , a medium one and a small one. In the left upper corner there is some kind of a compass that gives an idea where the current ufo is situated. You have 2 minutes to shoot as many ufos as possible:
Controls:
d-pad controls your ship
a-button fires the lasers
b-button goes to game over screen
c-button: starts game
Video of gameplay (It runs a bit faster on hardware):
ufo.bin (159.8 KB)
ufo.zip (60.5 KB)
I have made an intro song as wel but I am currently not able to add it to the game. If anyone is interested, you can give it a listen here: https://soundcloud.com/sbmrgd/ufo-intro
I had much fun making it. The code itself is rather messy… I hope you enjoy the game.
Looks fun! Added to the list.
A new version released (sound support!):
I’d like to update my entry to align with latest build of the python editor:
Rexitto.zip (26.3 KB)
rexitto.bin (152.6 KB)
Still a couple of days to file a competition entry. Lets see if we have the last minute rush in the end
Updated the entry.
I was intending to write something quick and simple to enter but I just ran into too many issues.
No enums? Fine, I can live with having to resort to using bare integers.
Can’t use floats? Ok, I know how to write fixed point types.
Operator overloading not working for *
and /
…
Having to write Vector.multiply
everywhere is just too tedious.
I know you guys worked hard on the environment and the editor,
but there’s just one too many limitations for me.
Camon @Pharap, just a little entry. To share some fun. The more we are the best will be. Bat computer will take in consideration your exit from comfort zone ;l
I think that’s as fair a judgement as any other. We understand (or at least I do)
I’m probably not going to have time in the next 2 days.
I can’t write Python as fast as languages I’m used to because I have to keep stopping to check the docs.
Also I’d have to think of a new game to write.
I was orignally going to write Asteroids,
but without floats or fixed points with operators that’s going to be pretty difficult (or at least tedious) to do.
My only other idea is Noughts & Crosses, but that’s far too simple for a decent contest entry,
and it would probably be pretty boring to write anyway.
For the record I’m comfortable writing Python code.
It’s the number of extra obstacles that cropped up that wore away at me.
Maybe you could change the name of the class to ‘v’ and the member function to ‘m’ so that you only have to type ‘v.m’. That will save you some time! Seriously though, I understand it but I would have liked to see your entry! I guess we all will have to wait until the next assembly competition!
@Pharap, yes, if you do it in a meticulous way (and you do everything in a meticulous way, which is admirable)
I had to deal with “vector maths” also with Pyrates! How else do you think wind direction and ship direction can be taken into account?
Solution was just a simple ship unit vector vs. wind unit vector matrix table. Could easily be implemented for Asteroids-type game.Then just use vx an vy components from there on.
You know there’s autocomplete with Ctrl+space? No need to keep names short.
Single-letter identifiers are evil and should be avoided. (With a few small exceptions.)
The issue isn’t the time taken to type it (I have no problem with long identifiers),
it’s the reduced readability of the resulting expressions.
With operators you can write something like:
resultVector = (position + ((direction * speed) / mass))
Without them it becomes:
resultVector = Vector.add(position, Vector.divide(Vector.multiply(direction, speed), mass))
Which is much less natural.
Admitedly it’s only the multiplication and division operators that are missing,
but that’s still one operator and two functions for the example snippet.
This is as far as I got:
#
# Copyright (C) 2019 Pharap (@Pharap)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import upygame as game
import umachine as pokitto
import urandom as random
class Q8x8:
def __init__(self, value = 0):
self.value = value
def get_integer(self):
return (self.value >> 8)
def get_fractional(self):
return (self.value & 0xFF)
def __add__(self, other):
return UQ8x8(self.value + other.value)
def __sub__(self, other):
return UQ8x8(self.value - other.value)
def __mul__(self, other):
return UQ8x8((self.value * other.value) >> 8)
def __div__(self, other):
return UQ8x8((self.value << 8) / other.value)
def __floordiv__(self, other):
return UQ8x8((self.value << 8) // other.value)
def test_Q8x8():
# 1.5
a = Q8x8(0x0180)
# 2.5
b = Q8x8(0x0280)
print(a == b)
print(a != b)
print(a < b)
print(a > b)
print(a.get_integer(), a.get_fractional())
print(b.get_integer(), b.get_fractional())
c = a + b
print(c.get_integer(), c.get_fractional())
d = a - b
print(d.get_integer(), d.get_fractional())
e = a * b
print(e.get_integer(), e.get_fractional())
class Vector:
def __init__(self, x = 0, y = 0):
self.x = x
self.y = y
def __add__(self, other):
x = (self.x + other.x)
y = (self.y + other.y)
return Vector(x, y)
def __sub__(self, other):
x = (self.x - other.x)
y = (self.y - other.y)
return Vector(x, y)
def __mul__(self, scale):
x = (self.x * scale)
y = (self.y * scale)
return Vector(x, y)
def __div__(self, scale):
x = (self.x / scale)
y = (self.y / scale)
return Vector(x, y)
def __floordiv__(self, scale):
x = (self.x // scale)
y = (self.y // scale)
return Vector(x, y)
def magnitude(self):
return sqrt((self.x * self.x) + (self.y * self.y))
@staticmethod
def dot(left, right):
x = (left.x * right.x)
y = (left.y * right.y)
return (x + y)
@staticmethod
def from_angle(angle):
x = cos(angle)
y = sin(angle)
return Vector(x, y)
def test_Vector():
v = Vector(5, 5)
v -= Vector(1, 1)
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, vector):
x = (self.x + vector.x)
y = (self.y + vector.y)
return Point(x, y)
def __sub__(self, other):
x = (self.x - vector.x)
y = (self.y - vector.y)
return Point(x, y)
class Asteroid:
def __init__(self, position, velocity):
self.position = position
self.velocity = velocity
class Direction:
north = 0
north_east = 1
east = 2
south_east = 3
south = 4
south_west = 5
west = 6
north_west = 7
direction_vectors = [
# North
Vector(Q8x8(0x0000), Q8x8(0x0100)),
# North East
Vector(Q8x8(0x00B5), Q8x8(0x00B5)),
# East
Vector(Q8x8(0x0100), Q8x8(0x0000)),
# South East
Vector(Q8x8(0x00B5), Q8x8(0xFF4B)),
# South
Vector(Q8x8(0x0000), Q8x8(0xFF00)),
# South West
Vector(Q8x8(0xFF4B), Q8x8(0xFF4B)),
# West
Vector(Q8x8(0xFF00), Q8x8(0x0000)),
# North West
Vector(Q8x8(0xFF4B), Q8x8(0x00B5))
]
def get_direction_vector(direction):
return direction_vectors[direction]
class Ship:
def __init__(self, position, heading, velocity):
self.position = position
self.heading = heading
self.velocity = velocity
def handle_down():
return
def handle_left():
return
def handle_right():
return
def handle_up():
return
def update():
event = game.event.poll()
if event != game.NOEVENT:
print("Event")
if event.type == game.KEYDOWN:
print("Keydown")
elif event.type == game.KEYUP:
print("Keyup")
def draw():
return
def main():
while true:
update()
draw()
game.display.flip()
main()
It was never going to be anything particularly impressive.
(And there’s no point in writing a C++ version because there’s already an Asteroids game for Pokitto.)
I can’t not do it in a ‘meticulous’ way.
If I write it in a messy way I won’t be able to read it if I ever look at it again.
I’ve got quite a lot of old projects like that - they do some cool stuff but I can’t make sense of half the code.
With my newer, better organised approach I can still make sense of the code even after having forgotten how it works and/or having not touched it in over a year.
People who don’t know about vectors or don’t use vectors tend to handle the x and y components separately,
which works, but doubles the (source) code size and is a pain to work with.
I finally managed to complete my entry.
ScummPy Quest I: The Jammed Door, not really a full adventure but a point-and-click puzzle.
Source: scummpy.zip (76.3 KB)
Binary: scummpy.bin (178.3 KB)
Holy sh…
wowzaaa!
Edit: Batcomputer and @Hanski are going to have to really deliberate over all these high quality entries.
Just in time Looks very nice and is a fresh genre in this competition.